summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c1f9197)
raw | patch | inline | side by side (parent: c1f9197)
author | Simon Hausmann <simon@lst.de> | |
Thu, 24 May 2007 19:23:04 +0000 (21:23 +0200) | ||
committer | Simon Hausmann <simon@lst.de> | |
Thu, 24 May 2007 19:23:04 +0000 (21:23 +0200) |
Signed-off-by: Simon Hausmann <simon@lst.de>
contrib/fast-import/git-p4 | patch | blob | history |
index 09b3cb5573a5667394ea62729991ada7ebf14972..b587e79b482975cff1e366a1d3c33ea95e944a3a 100755 (executable)
self.p4BranchesInGit.append(branch)
self.initialParents[self.refPrefix + branch] = parseRevision(line[:-1])
+ def createBranchesFromOrigin(self):
+ if not self.silent:
+ print "Creating branch(es) in %s based on origin branch(es)" % self.refPrefix
+
+ for line in mypopen("git rev-parse --symbolic --remotes"):
+ if (not line.startswith("origin/")) or line.endswith("HEAD\n"):
+ continue
+ headName = line[len("origin/"):-1]
+ remoteHead = self.refPrefix + headName
+ if not os.path.exists(gitdir + "/" + remoteHead):
+ if self.verbose:
+ print "creating %s" % remoteHead
+ system("git update-ref %s origin/%s" % (remoteHead, headName))
+
def run(self, args):
self.depotPath = ""
self.changeRange = ""
self.listExistingP4GitBranches()
if len(self.p4BranchesInGit) > 1:
if not self.silent:
- print "Importing from/into multiple branches"
+ print "Importing from/into multiple branches"
self.detectBranches = True
if len(args) == 0:
- if not gitBranchExists(self.branch) and gitBranchExists("origin") and not self.detectBranches:
- ### needs to be ported to multi branch import
- if not self.silent:
- print "Creating %s branch in git repository based on origin" % self.branch
- branch = self.branch
- if not branch.startswith("refs"):
- branch = "refs/heads/" + branch
- system("git update-ref %s origin" % branch)
+ if len(self.p4BranchesInGit) == 0:
+ self.createBranchesFromOrigin()
+ self.listExistingP4GitBranches()
+ return True
if self.verbose:
print "branches: %s" % self.p4BranchesInGit