Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Hausmann <shausman@trolltech.com>2007-06-12 16:31:59 +0400
committerSimon Hausmann <shausman@trolltech.com>2007-06-12 16:31:59 +0400
commit27d2d8119bf985a0b59152737316f04f871e03f7 (patch)
treec8779d2dbd0536ce2c1ec57e48d5c02e80c63810 /contrib/fast-import
parente6b711f00e4578eb4b2127af12f73a5fa438f948 (diff)
Moved the code from git-p4 submit to figure out the upstream branch point
into a separate helper method. Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Diffstat (limited to 'contrib/fast-import')
-rwxr-xr-xcontrib/fast-import/git-p445
1 files changed, 26 insertions, 19 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 21f9ba7e07..1c7db11529 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -168,6 +168,28 @@ def gitBranchExists(branch):
def gitConfig(key):
return read_pipe("git config %s" % key, ignore_error=True).strip()
+def findUpstreamBranchPoint():
+ settings = None
+ branchPoint = ""
+ parent = 0
+ while parent < 65535:
+ commit = "HEAD~%s" % parent
+ log = extractLogMessageFromGitCommit(commit)
+ settings = extractSettingsGitLog(log)
+ if not settings.has_key("depot-paths"):
+ parent = parent + 1
+ continue
+
+ names = read_pipe_lines("git name-rev '--refs=refs/remotes/p4/*' '%s'" % commit)
+ if len(names) <= 0:
+ continue
+
+ # strip away the beginning of 'HEAD~42 refs/remotes/p4/foo'
+ branchPoint = names[0].strip()[len(commit) + 1:]
+ break
+
+ return [branchPoint, settings]
+
class Command:
def __init__(self):
self.usage = "usage: %prog [options]"
@@ -494,25 +516,10 @@ class P4Submit(Command):
else:
return False
- depotPath = ""
- parent = 0
- while parent < 65535:
- commit = "HEAD~%s" % parent
- log = extractLogMessageFromGitCommit(commit)
- settings = extractSettingsGitLog(log)
- if not settings.has_key("depot-paths"):
- parent = parent + 1
- continue
-
- depotPath = settings['depot-paths'][0]
-
- if len(self.origin) == 0:
- names = read_pipe_lines("git name-rev '--refs=refs/remotes/p4/*' '%s'" % commit)
- if len(names) > 0:
- # strip away the beginning of 'HEAD~42 refs/remotes/p4/foo'
- self.origin = names[0].strip()[len(commit) + 1:]
-
- break
+ [upstream, settings] = findUpstreamBranchPoint()
+ depotPath = settings['depot-paths'][0]
+ if len(self.origin) == 0:
+ self.origin = upstream
if self.verbose:
print "Origin branch is " + self.origin