summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e6b711f)
raw | patch | inline | side by side (parent: e6b711f)
author | Simon Hausmann <shausman@trolltech.com> | |
Tue, 12 Jun 2007 12:31:59 +0000 (14:31 +0200) | ||
committer | Simon Hausmann <shausman@trolltech.com> | |
Tue, 12 Jun 2007 12:31:59 +0000 (14:31 +0200) |
into a separate helper method.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
contrib/fast-import/git-p4 | patch | blob | history |
index 21f9ba7e07e8eb577c9ef722fd30f7f30ce9f652..1c7db11529037091b324c65f24dcbf3dd7e05b5d 100755 (executable)
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]"
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