Fix the docs for git-p4 submit and turn git-p4 submit --master=foo into simply git-p4 submit mytopicbranch.
Fix the docs for git-p4 submit and turn git-p4 submit --master=foo into simply git-p4 submit mytopicbranch. Signed-off-by: Simon Hausmann <hausmann@kde.org>
Simon Hausmann committed
Mar 29, 2007 at 19:15 UTC
c9b50e6307aa9931e18b6cd4d00de817b8e4a4c2
2 files changed
+20
-21
contrib/fast-import/git-p4
+11
-7
@@ -167,13 +167,13 @@ class P4Sync(Command):
167
optparse.make_option("--continue", action="store_false", dest="firstTime"),
168
optparse.make_option("--origin", dest="origin"),
169
optparse.make_option("--reset", action="store_true", dest="reset"),
170
- optparse.make_option("--master", dest="master"),
170
optparse.make_option("--log-substitutions", dest="substFile"),
171
optparse.make_option("--noninteractive", action="store_false"),
172
optparse.make_option("--dry-run", action="store_true"),
173
optparse.make_option("--apply-as-patch", action="store_true", dest="applyAsPatch")
174
]
175
self.description = "Submit changes from git to the perforce depot."
176
+ self.usage += " [name of git branch to submit into perforce depot]"
177
self.firstTime = True
178
self.reset = False
179
self.interactive = True
@@ -181,7 +181,6 @@ class P4Sync(Command):
181
self.substFile = ""
182
self.firstTime = True
183
self.origin = ""
184
- self.master = ""
184
self.applyAsPatch = True
185
186
self.logSubstitutions = {}
@@ -326,6 +325,16 @@ class P4Sync(Command):
325
# make gitdir absolute so we can cd out into the perforce checkout
326
gitdir = os.path.abspath(gitdir)
327
os.environ["GIT_DIR"] = gitdir
328
+
329
+ if len(args) == 0:
330
+ self.master = currentGitBranch()
331
+ if len(self.master) == 0 or not os.path.exists("%s/refs/heads/%s" % (gitdir, self.master)):
332
+ die("Detecting current git branch failed!")
333
+ elif len(args) == 1:
334
+ self.master = args[0]
335
+ else:
336
+ return False
337
+
338
depotPath = ""
339
if gitBranchExists("p4"):
340
[depotPath, dummy] = extractDepotPathAndChangeFromGitLog(extractLogMessageFromGitCommit("p4"))
@@ -362,11 +371,6 @@ class P4Sync(Command):
371
tokens = line[:-1].split("=")
372
self.logSubstitutions[tokens[0]] = tokens[1]
373
365
- if len(self.master) == 0:
366
- self.master = currentGitBranch()
367
- if len(self.master) == 0 or not os.path.exists("%s/refs/heads/%s" % (gitdir, self.master)):
368
- die("Detecting current git branch failed!")
369
-
374
self.check()
375
self.configFile = gitdir + "/p4-git-sync.cfg"
376
self.config = shelve.open(self.configFile, writeback=True)
contrib/fast-import/git-p4.txt
+9
-14
@@ -49,23 +49,19 @@ incremental import creates through the use of git-fast-import.
49
Submitting
50
==========
51
52
-git-p4 has EXPERIMENTAL support for submitting changes from a git repository
53
-back to a Perforce depot. This requires a Perforce checkout separate to your
54
-git repository. All it should take is calling
52
+git-p4 has support for submitting changes from a git repository back to the
53
+Perforce depot. This requires a Perforce checkout separate to your git
54
+repository. To submit all changes that are in the current git branch but not in
55
+the "p4" branch (or "origin" if "p4" doesn't exist) simply call
56
57
git-p4 submit
58
58
-in your git repository. This will attempt to locate the perforce checkout
59
-corresponding to your imported depot path. By default the changes between your
60
-current branch and the "p4" branch will be submitted. If there is no "p4"
61
-branch the "origin" branch will be used as reference instead. You can override
62
-this with the --origin=mysourcebranch option. The "origin" branch has to be the
63
-branch populated with git-p4's sync operation.
59
+in your git repository. If you want to submit changes in a specific branch that
60
+is not your current git branch you can also pass that as an argument:
61
65
-After some preparations (which might take a while) git-p4 enters a loop where
66
-it will first show a Perforce submit template and a diff of the change to
67
-apply in the editor. After saving and exiting the editor you will be asked whether
68
-you really want to submit the change or not.
62
+ git-p4 submit mytopicbranch
63
+
64
+You can override the reference branch with the --origin=mysourcebranch option.
65
66
If a submit fails you may have to "p4 resolve" and submit manually. You can
67
continue importing the remaining changes with
@@ -74,4 +70,3 @@ continue importing the remaining changes with
70
71
After submitting you should sync your perforce import branch ("p4" or "origin")
72
from Perforce using git-p4's sync command.
77
-