git-p4: Removed git-p4 submit --direct.
This feature was originally meant to allow for quicker direct submits into perforce, but it turns out that it is not actually quicker than doing a git commit and then running git-p4 submit. Signed-off-by: Simon Hausmann <simon@lst.de>maint
parent
edae1e2f40
commit
0e36f2d726
|
@ -468,7 +468,6 @@ class P4Submit(Command):
|
||||||
optparse.make_option("--verbose", dest="verbose", action="store_true"),
|
optparse.make_option("--verbose", dest="verbose", action="store_true"),
|
||||||
optparse.make_option("--origin", dest="origin"),
|
optparse.make_option("--origin", dest="origin"),
|
||||||
optparse.make_option("--reset", action="store_true", dest="reset"),
|
optparse.make_option("--reset", action="store_true", dest="reset"),
|
||||||
optparse.make_option("--direct", dest="directSubmit", action="store_true"),
|
|
||||||
optparse.make_option("-M", dest="detectRename", action="store_true"),
|
optparse.make_option("-M", dest="detectRename", action="store_true"),
|
||||||
]
|
]
|
||||||
self.description = "Submit changes from git to the perforce depot."
|
self.description = "Submit changes from git to the perforce depot."
|
||||||
|
@ -478,7 +477,6 @@ class P4Submit(Command):
|
||||||
self.interactive = True
|
self.interactive = True
|
||||||
self.firstTime = True
|
self.firstTime = True
|
||||||
self.origin = ""
|
self.origin = ""
|
||||||
self.directSubmit = False
|
|
||||||
self.detectRename = False
|
self.detectRename = False
|
||||||
self.verbose = False
|
self.verbose = False
|
||||||
self.isWindows = (platform.system() == "Windows")
|
self.isWindows = (platform.system() == "Windows")
|
||||||
|
@ -494,9 +492,6 @@ class P4Submit(Command):
|
||||||
"maybe you want to call git-p4 submit --reset" % self.configFile)
|
"maybe you want to call git-p4 submit --reset" % self.configFile)
|
||||||
|
|
||||||
commits = []
|
commits = []
|
||||||
if self.directSubmit:
|
|
||||||
commits.append("0")
|
|
||||||
else:
|
|
||||||
for line in read_pipe_lines("git rev-list --no-merges %s..%s" % (self.origin, self.master)):
|
for line in read_pipe_lines("git rev-list --no-merges %s..%s" % (self.origin, self.master)):
|
||||||
commits.append(line.strip())
|
commits.append(line.strip())
|
||||||
commits.reverse()
|
commits.reverse()
|
||||||
|
@ -556,10 +551,6 @@ class P4Submit(Command):
|
||||||
return template
|
return template
|
||||||
|
|
||||||
def applyCommit(self, id):
|
def applyCommit(self, id):
|
||||||
if self.directSubmit:
|
|
||||||
print "Applying local change in working directory/index"
|
|
||||||
diff = self.diffStatus
|
|
||||||
else:
|
|
||||||
print "Applying %s" % (read_pipe("git log --max-count=1 --pretty=oneline %s" % id))
|
print "Applying %s" % (read_pipe("git log --max-count=1 --pretty=oneline %s" % id))
|
||||||
diffOpts = ("", "-M")[self.detectRename]
|
diffOpts = ("", "-M")[self.detectRename]
|
||||||
diff = read_pipe_lines("git diff-tree -r %s \"%s^\" \"%s\"" % (diffOpts, id, id))
|
diff = read_pipe_lines("git diff-tree -r %s \"%s^\" \"%s\"" % (diffOpts, id, id))
|
||||||
|
@ -597,9 +588,6 @@ class P4Submit(Command):
|
||||||
else:
|
else:
|
||||||
die("unknown modifier %s for %s" % (modifier, path))
|
die("unknown modifier %s for %s" % (modifier, path))
|
||||||
|
|
||||||
if self.directSubmit:
|
|
||||||
diffcmd = "cat \"%s\"" % self.diffFile
|
|
||||||
else:
|
|
||||||
diffcmd = "git format-patch -k --stdout \"%s^\"..\"%s\"" % (id, id)
|
diffcmd = "git format-patch -k --stdout \"%s^\"..\"%s\"" % (id, id)
|
||||||
patchcmd = diffcmd + " | git apply "
|
patchcmd = diffcmd + " | git apply "
|
||||||
tryPatchCmd = patchcmd + "--check -"
|
tryPatchCmd = patchcmd + "--check -"
|
||||||
|
@ -648,8 +636,6 @@ class P4Submit(Command):
|
||||||
mode = filesToChangeExecBit[f]
|
mode = filesToChangeExecBit[f]
|
||||||
setP4ExecBit(f, mode)
|
setP4ExecBit(f, mode)
|
||||||
|
|
||||||
logMessage = ""
|
|
||||||
if not self.directSubmit:
|
|
||||||
logMessage = extractLogMessageFromGitCommit(id)
|
logMessage = extractLogMessageFromGitCommit(id)
|
||||||
if self.isWindows:
|
if self.isWindows:
|
||||||
logMessage = logMessage.replace("\n", "\r\n")
|
logMessage = logMessage.replace("\n", "\r\n")
|
||||||
|
@ -692,12 +678,6 @@ class P4Submit(Command):
|
||||||
if self.isWindows:
|
if self.isWindows:
|
||||||
submitTemplate = submitTemplate.replace("\r\n", "\n")
|
submitTemplate = submitTemplate.replace("\r\n", "\n")
|
||||||
|
|
||||||
if self.directSubmit:
|
|
||||||
print "Submitting to git first"
|
|
||||||
os.chdir(self.oldWorkingDirectory)
|
|
||||||
write_pipe("git commit -a -F -", submitTemplate)
|
|
||||||
os.chdir(self.clientPath)
|
|
||||||
|
|
||||||
write_pipe("p4 submit -i", submitTemplate)
|
write_pipe("p4 submit -i", submitTemplate)
|
||||||
else:
|
else:
|
||||||
fileName = "submit.txt"
|
fileName = "submit.txt"
|
||||||
|
@ -739,17 +719,6 @@ class P4Submit(Command):
|
||||||
print "Perforce checkout for depot path %s located at %s" % (self.depotPath, self.clientPath)
|
print "Perforce checkout for depot path %s located at %s" % (self.depotPath, self.clientPath)
|
||||||
self.oldWorkingDirectory = os.getcwd()
|
self.oldWorkingDirectory = os.getcwd()
|
||||||
|
|
||||||
if self.directSubmit:
|
|
||||||
self.diffStatus = read_pipe_lines("git diff -r --name-status HEAD")
|
|
||||||
if len(self.diffStatus) == 0:
|
|
||||||
print "No changes in working directory to submit."
|
|
||||||
return True
|
|
||||||
patch = read_pipe("git diff -p --binary --diff-filter=ACMRTUXB HEAD")
|
|
||||||
self.diffFile = self.gitdir + "/p4-git-diff"
|
|
||||||
f = open(self.diffFile, "wb")
|
|
||||||
f.write(patch)
|
|
||||||
f.close();
|
|
||||||
|
|
||||||
os.chdir(self.clientPath)
|
os.chdir(self.clientPath)
|
||||||
print "Syncronizing p4 checkout..."
|
print "Syncronizing p4 checkout..."
|
||||||
system("p4 sync ...")
|
system("p4 sync ...")
|
||||||
|
@ -777,9 +746,6 @@ class P4Submit(Command):
|
||||||
|
|
||||||
self.config.close()
|
self.config.close()
|
||||||
|
|
||||||
if self.directSubmit:
|
|
||||||
os.remove(self.diffFile)
|
|
||||||
|
|
||||||
if len(commits) == 0:
|
if len(commits) == 0:
|
||||||
if self.firstTime:
|
if self.firstTime:
|
||||||
print "No changes found to apply between %s and current HEAD" % self.origin
|
print "No changes found to apply between %s and current HEAD" % self.origin
|
||||||
|
|
Loading…
Reference in New Issue