Add a "--notags" option for git-p4import.
P4import currently creates a git tag for every commit it imports. When importing from a large repository too many tags can be created for git to manage, so this provides an option to shut that feature off if necessary. Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Sean committed
Jun 15, 2006 at 17:26 UTC
ada7781dc3602e6efc052e5e0da37a63caae0489
2 files changed
+12
-5
Documentation/git-p4import.txt
+4
-1
@@ -8,7 +8,7 @@ git-p4import - Import a Perforce repository into git
8
9
SYNOPSIS
10
--------
11
-`git-p4import` [-q|-v] [--authors <file>] [-t <timezone>] <//p4repo/path> <branch>
11
+`git-p4import` [-q|-v] [--notags] [--authors <file>] [-t <timezone>] <//p4repo/path> <branch>
12
13
`git-p4import` --stitch <//p4repo/path>
14
@@ -43,6 +43,9 @@ OPTIONS
43
Specify an authors file containing a mapping of Perforce user
44
ids to full names and email addresses (see Notes below).
45
46
+\--notags::
47
+ Do not create a tag for each imported commit.
48
+
49
\--stitch::
50
Import the contents of the given perforce branch into the
51
currently checked out git branch.
git-p4import.py
+8
-4
@@ -23,7 +23,6 @@ s = signal(SIGINT, SIG_DFL)
23
if s != default_int_handler:
24
signal(SIGINT, s)
25
26
-
26
def die(msg, *args):
27
for a in args:
28
msg = "%s %s" % (msg, a)
@@ -38,6 +37,7 @@ verbosity = 1
37
logfile = "/dev/null"
38
ignore_warnings = False
39
stitch = 0
40
+tagall = True
41
42
def report(level, msg, *args):
43
global verbosity
@@ -261,10 +261,9 @@ class git_command:
261
self.make_tag("p4/%s"%id, commit)
262
self.git("update-ref HEAD %s %s" % (commit, current) )
263
264
-
264
try:
265
opts, args = getopt.getopt(sys.argv[1:], "qhvt:",
267
- ["authors=","help","stitch=","timezone=","log=","ignore"])
266
+ ["authors=","help","stitch=","timezone=","log=","ignore","notags"])
267
except getopt.GetoptError:
268
usage()
269
@@ -275,6 +274,8 @@ for o, a in opts:
274
verbosity += 1
275
if o in ("--log"):
276
logfile = a
277
+ if o in ("--notags"):
278
+ tagall = False
279
if o in ("-h", "--help"):
280
usage()
281
if o in ("--ignore"):
@@ -350,7 +351,10 @@ for id in changes:
351
report(1, "Importing changeset", id)
352
change = p4.describe(id)
353
p4.sync(id)
353
- git.commit(change.author, change.email, change.date, change.msg, id)
354
+ if tagall :
355
+ git.commit(change.author, change.email, change.date, change.msg, id)
356
+ else:
357
+ git.commit(change.author, change.email, change.date, change.msg, "import")
358
if stitch == 1:
359
git.clean_directories()
360
stitch = 0