diff options
author | Simon Hausmann <simon@lst.de> | 2007-05-17 09:13:54 +0200 |
---|---|---|
committer | Simon Hausmann <simon@lst.de> | 2007-05-17 09:13:54 +0200 |
commit | 463e8af65577b1df4495cb08640840234ac80c86 (patch) | |
tree | b4c6d20f66dd92dfa04c72ab8b2968c807a35d96 /contrib/fast-import | |
parent | f9162f6a4cc9f4af3e527412b364a8eda4502920 (diff) | |
download | git-463e8af65577b1df4495cb08640840234ac80c86.tar.gz git-463e8af65577b1df4495cb08640840234ac80c86.tar.xz |
Clean up code duplication for revision parsing and fix previous commit to not
import into remotes/p4 (yet!).
Signed-off-by: Simon Hausmann <simon@lst.de>
Diffstat (limited to 'contrib/fast-import')
-rwxr-xr-x | contrib/fast-import/git-p4 | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index 1f549b5c6..e18f3cb8a 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -69,6 +69,9 @@ def isValidGitDir(path): return True; return False +def parseRevision(ref): + return mypopen("git rev-parse %s" % ref).read()[:-1] + def system(cmd): if os.system(cmd) != 0: die("command failed: %s" % cmd) @@ -865,7 +868,7 @@ class P4Sync(Command): self.previousDepotPath = "" if len(self.branch) == 0: - self.branch = "refs/remotes/p4" + self.branch = "p4" if len(args) == 0: if not gitBranchExists(self.branch) and gitBranchExists("origin"): @@ -878,7 +881,7 @@ class P4Sync(Command): p4Change = int(p4Change) + 1 self.depotPath = self.previousDepotPath self.changeRange = "@%s,#head" % p4Change - self.initialParent = mypopen("git rev-parse %s" % self.branch).read()[:-1] + self.initialParent = parseRevision(self.branch) if not self.silent: print "Performing incremental import into %s git branch" % self.branch @@ -943,7 +946,7 @@ class P4Sync(Command): endPos = caretIdx self.rev = int(output[tagIdx + 9 : endPos]) + 1 self.changeRange = "@%s,#head" % self.rev - self.initialParent = mypopen("git rev-parse %s" % self.branch).read()[:-1] + self.initialParent = parseRevision(self.branch) except: pass |