@matheusbsbs / matheus-bagliano / commits / 9863f4055e
Fork 0

Prefer git command over git-command.

Signed-off-by: Simon Hausmann <simon@lst.de>

Simon Hausmann committed Mar 24, 2007 at 16:35 UTC 9863f4055e1219904f6d26c2803a72fc6c8ce561
1 file changed +14 -14
contrib/fast-import/git-p4
+14 -14
@@ -57,7 +57,7 @@ def die(msg):
57 sys.exit(1)
58
59 def currentGitBranch():
60 - return os.popen("git-name-rev HEAD").read().split(" ")[1][:-1]
60 + return os.popen("git name-rev HEAD").read().split(" ")[1][:-1]
61
62 def isValidGitDir(path):
63 if os.path.exists(path + "/HEAD") and os.path.exists(path + "/refs") and os.path.exists(path + "/objects"):
@@ -71,7 +71,7 @@ def system(cmd):
71 def extractLogMessageFromGitCommit(commit):
72 logMessage = ""
73 foundTitle = False
74 - for log in os.popen("git-cat-file commit %s" % commit).readlines():
74 + for log in os.popen("git cat-file commit %s" % commit).readlines():
75 if not foundTitle:
76 if len(log) == 1:
77 foundTitle = 1
@@ -100,7 +100,7 @@ def extractDepotPathAndChangeFromGitLog(log):
100 return values.get("depot-path"), values.get("change")
101
102 def gitBranchExists(branch):
103 - if os.system("git-rev-parse %s 2>/dev/null >/dev/null" % branch) == 0:
103 + if os.system("git rev-parse %s 2>/dev/null >/dev/null" % branch) == 0:
104 return True
105 return False
106
@@ -130,7 +130,7 @@ class P4CleanTags(Command):
130 def run(self, args):
131 branch = currentGitBranch()
132 print "Cleaning out stale p4 import tags..."
133 - sout, sin, serr = popen2.popen3("git-name-rev --tags `git-rev-parse %s`" % branch)
133 + sout, sin, serr = popen2.popen3("git name-rev --tags `git rev-parse %s`" % branch)
134 output = sout.read()
135 try:
136 tagIdx = output.index(" tags/p4/")
@@ -195,7 +195,7 @@ class P4Sync(Command):
195 die("Cannot start sync. Previous sync config found at %s" % self.configFile)
196
197 commits = []
198 - for line in os.popen("git-rev-list --no-merges %s..%s" % (self.origin, self.master)).readlines():
198 + for line in os.popen("git rev-list --no-merges %s..%s" % (self.origin, self.master)).readlines():
199 commits.append(line[:-1])
200 commits.reverse()
201
@@ -229,7 +229,7 @@ class P4Sync(Command):
229 return result
230
231 def apply(self, id):
232 - print "Applying %s" % (os.popen("git-log --max-count=1 --pretty=oneline %s" % id).read())
232 + print "Applying %s" % (os.popen("git log --max-count=1 --pretty=oneline %s" % id).read())
233 diff = os.popen("git diff-tree -r --name-status \"%s^\" \"%s\"" % (id, id)).readlines()
234 filesToAdd = set()
235 filesToDelete = set()
@@ -250,9 +250,9 @@ class P4Sync(Command):
250 die("unknown modifier %s for %s" % (modifier, path))
251
252 if self.applyAsPatch:
253 - system("git-diff-tree -p --diff-filter=ACMRTUXB \"%s^\" \"%s\" | patch -p1" % (id, id))
253 + system("git diff-tree -p --diff-filter=ACMRTUXB \"%s^\" \"%s\" | patch -p1" % (id, id))
254 else:
255 - system("git-diff-files --name-only -z | git-update-index --remove -z --stdin")
255 + system("git diff-files --name-only -z | git update-index --remove -z --stdin")
256 system("git cherry-pick --no-commit \"%s\"" % id)
257
258 for f in filesToAdd:
@@ -783,7 +783,7 @@ class GitSync(Command):
783 self.branch = "refs/heads/" + self.branch
784
785 if len(self.globalPrefix) == 0:
786 - self.globalPrefix = self.previousDepotPath = os.popen("git-repo-config --get p4.depotpath").read()
786 + self.globalPrefix = self.previousDepotPath = os.popen("git repo-config --get p4.depotpath").read()
787
788 if len(self.globalPrefix) != 0:
789 self.globalPrefix = self.globalPrefix[:-1]
@@ -830,7 +830,7 @@ class GitSync(Command):
830
831 if len(self.changeRange) == 0:
832 try:
833 - sout, sin, serr = popen2.popen3("git-name-rev --tags `git-rev-parse %s`" % self.branch)
833 + sout, sin, serr = popen2.popen3("git name-rev --tags `git rev-parse %s`" % self.branch)
834 output = sout.read()
835 if output.endswith("\n"):
836 output = output[:-1]
@@ -841,7 +841,7 @@ class GitSync(Command):
841 endPos = caretIdx
842 self.rev = int(output[tagIdx + 9 : endPos]) + 1
843 self.changeRange = "@%s,#head" % self.rev
844 - self.initialParent = os.popen("git-rev-parse %s" % self.branch).read()[:-1]
844 + self.initialParent = os.popen("git rev-parse %s" % self.branch).read()[:-1]
845 self.initialTag = "p4/%s" % (int(self.rev) - 1)
846 except:
847 pass
@@ -851,7 +851,7 @@ class GitSync(Command):
851 if tzsign != '+' and tzsign != '-':
852 self.tz = "+" + ("%s" % self.tz)
853
854 - self.gitOutput, self.gitStream, self.gitError = popen2.popen3("git-fast-import")
854 + self.gitOutput, self.gitStream, self.gitError = popen2.popen3("git fast-import")
855
856 if len(self.revision) > 0:
857 print "Doing initial import of %s from revision %s" % (self.globalPrefix, self.revision)
@@ -971,7 +971,7 @@ class GitSync(Command):
971 self.gitOutput.close()
972 self.gitError.close()
973
974 - os.popen("git-repo-config p4.depotpath %s" % self.globalPrefix).read()
974 + os.popen("git repo-config p4.depotpath %s" % self.globalPrefix).read()
975 if len(self.initialTag) > 0:
976 os.popen("git tag -d %s" % self.initialTag).read()
977
@@ -1031,7 +1031,7 @@ gitdir = cmd.gitdir
1031 if len(gitdir) == 0:
1032 gitdir = ".git"
1033 if not isValidGitDir(gitdir):
1034 - cdup = os.popen("git-rev-parse --show-cdup").read()[:-1]
1034 + cdup = os.popen("git rev-parse --show-cdup").read()[:-1]
1035 if isValidGitDir(cdup + "/" + gitdir):
1036 os.chdir(cdup)
1037