{"thread":{"id":"4525","subject":"[PATCH] Add a \"--notags\" option for git-p4import.","startedAt":"2006-06-15T21:26:21Z","lastAt":"2006-06-15T21:26:21Z","messageCount":1,"participants":["Sean"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"21854","messageId":"BAYC1-PASMTP0215C04B53D4FD5E21BE9FAE820@CEZ.ICE","threadId":"4525","inReplyTo":null,"subject":"[PATCH] Add a \"--notags\" option for git-p4import.","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2006-06-15T21:26:21Z","receivedAt":"2006-06-15T21:26:21Z","isPatch":true,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"\nP4import currently creates a git tag for every commit it imports.\nWhen importing from a large repository too many tags can be created\nfor git to manage, so this provides an option to shut that feature\noff if necessary.\n\nSigned-off-by: Sean Estabrooks <seanlkml@sympatico.ca>\n---\n Documentation/git-p4import.txt |    5 ++++-\n git-p4import.py                |   12 ++++++++----\n 2 files changed, 12 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-p4import.txt b/Documentation/git-p4import.txt\nindex c198ff2..0858e5e 100644\n--- a/Documentation/git-p4import.txt\n+++ b/Documentation/git-p4import.txt\n@@ -8,7 +8,7 @@ git-p4import - Import a Perforce reposit\n \n SYNOPSIS\n --------\n-`git-p4import` [-q|-v] [--authors <file>] [-t <timezone>] <//p4repo/path> <branch>\n+`git-p4import` [-q|-v] [--notags] [--authors <file>] [-t <timezone>] <//p4repo/path> <branch>\n \n `git-p4import` --stitch <//p4repo/path>\n \n@@ -43,6 +43,9 @@ OPTIONS\n \tSpecify an authors file containing a mapping of Perforce user\n \tids to full names and email addresses (see Notes below).\n \n+\\--notags::\n+\tDo not create a tag for each imported commit.\n+\n \\--stitch::\n \tImport the contents of the given perforce branch into the\n \tcurrently checked out git branch.\ndiff --git a/git-p4import.py b/git-p4import.py\nindex 74172ab..908941d 100644\n--- a/git-p4import.py\n+++ b/git-p4import.py\n@@ -23,7 +23,6 @@ s = signal(SIGINT, SIG_DFL)\n if s != default_int_handler:\n    signal(SIGINT, s)\n \n-\n def die(msg, *args):\n     for a in args:\n         msg = \"%s %s\" % (msg, a)\n@@ -38,6 +37,7 @@ verbosity = 1\n logfile = \"/dev/null\"\n ignore_warnings = False\n stitch = 0\n+tagall = True\n \n def report(level, msg, *args):\n     global verbosity\n@@ -261,10 +261,9 @@ class git_command:\n         self.make_tag(\"p4/%s\"%id, commit)\n         self.git(\"update-ref HEAD %s %s\" % (commit, current) )\n \n-\n try:\n     opts, args = getopt.getopt(sys.argv[1:], \"qhvt:\",\n-                    [\"authors=\",\"help\",\"stitch=\",\"timezone=\",\"log=\",\"ignore\"])\n+            [\"authors=\",\"help\",\"stitch=\",\"timezone=\",\"log=\",\"ignore\",\"notags\"])\n except getopt.GetoptError:\n     usage()\n \n@@ -275,6 +274,8 @@ for o, a in opts:\n         verbosity += 1\n     if o in (\"--log\"):\n         logfile = a\n+    if o in (\"--notags\"):\n+        tagall = False\n     if o in (\"-h\", \"--help\"):\n         usage()\n     if o in (\"--ignore\"):\n@@ -350,7 +351,10 @@ for id in changes:\n     report(1, \"Importing changeset\", id)\n     change = p4.describe(id)\n     p4.sync(id)\n-    git.commit(change.author, change.email, change.date, change.msg, id)\n+    if tagall :\n+            git.commit(change.author, change.email, change.date, change.msg, id)\n+    else:\n+            git.commit(change.author, change.email, change.date, change.msg, \"import\")\n     if stitch == 1:\n         git.clean_directories()\n         stitch = 0\n-- \n1.4.0.rc2\n"}]}