Skip to content

Commit

Permalink
Add a "--notags" option for git-p4import.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sean authored and Junio C Hamano committed Jun 17, 2006
1 parent 5b139a6 commit ada7781
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Documentation/git-p4import.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ git-p4import - Import a Perforce repository into git

SYNOPSIS
--------
`git-p4import` [-q|-v] [--authors <file>] [-t <timezone>] <//p4repo/path> <branch>
`git-p4import` [-q|-v] [--notags] [--authors <file>] [-t <timezone>] <//p4repo/path> <branch>

`git-p4import` --stitch <//p4repo/path>

Expand Down Expand Up @@ -43,6 +43,9 @@ OPTIONS
Specify an authors file containing a mapping of Perforce user
ids to full names and email addresses (see Notes below).

\--notags::
Do not create a tag for each imported commit.

\--stitch::
Import the contents of the given perforce branch into the
currently checked out git branch.
Expand Down
12 changes: 8 additions & 4 deletions git-p4import.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
if s != default_int_handler:
signal(SIGINT, s)


def die(msg, *args):
for a in args:
msg = "%s %s" % (msg, a)
Expand All @@ -38,6 +37,7 @@ def usage():
logfile = "/dev/null"
ignore_warnings = False
stitch = 0
tagall = True

def report(level, msg, *args):
global verbosity
Expand Down Expand Up @@ -261,10 +261,9 @@ def commit(self, author, email, date, msg, id):
self.make_tag("p4/%s"%id, commit)
self.git("update-ref HEAD %s %s" % (commit, current) )


try:
opts, args = getopt.getopt(sys.argv[1:], "qhvt:",
["authors=","help","stitch=","timezone=","log=","ignore"])
["authors=","help","stitch=","timezone=","log=","ignore","notags"])
except getopt.GetoptError:
usage()

Expand All @@ -275,6 +274,8 @@ def commit(self, author, email, date, msg, id):
verbosity += 1
if o in ("--log"):
logfile = a
if o in ("--notags"):
tagall = False
if o in ("-h", "--help"):
usage()
if o in ("--ignore"):
Expand Down Expand Up @@ -350,7 +351,10 @@ def commit(self, author, email, date, msg, id):
report(1, "Importing changeset", id)
change = p4.describe(id)
p4.sync(id)
git.commit(change.author, change.email, change.date, change.msg, id)
if tagall :
git.commit(change.author, change.email, change.date, change.msg, id)
else:
git.commit(change.author, change.email, change.date, change.msg, "import")
if stitch == 1:
git.clean_directories()
stitch = 0
Expand Down

0 comments on commit ada7781

Please sign in to comment.