summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bce4c5f)
raw | patch | inline | side by side (parent: bce4c5f)
author | Han-Wen Nienhuys <hanwen@google.com> | |
Wed, 23 May 2007 20:41:50 +0000 (17:41 -0300) | ||
committer | Han-Wen Nienhuys <hanwen@google.com> | |
Mon, 28 May 2007 14:17:27 +0000 (11:17 -0300) |
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
contrib/fast-import/git-p4 | patch | blob | history |
index 8d649dd7628fd9c8079549a9bb73548255512481..93c9d6417cc013153235059117e6190b099790b0 100755 (executable)
return val
def read_pipe(c):
- sys.stderr.write('reading pipe: %s\n' % c)
+ if not silent:
+ sys.stderr.write('reading pipe: %s\n' % c)
## todo: check return status
pipe = os.popen(c, 'rb')
val = pipe.read()
def read_pipe_lines(c):
- sys.stderr.write('reading pipe: %s\n' % c)
+ if not silent:
+ sys.stderr.write('reading pipe: %s\n' % c)
## todo: check return status
pipe = os.popen(c, 'rb')
val = pipe.readlines()
return val
+def system(cmd):
+ if not silent:
+ sys.stderr.write("executing %s" % cmd)
+ if os.system(cmd) != 0:
+ die("command failed: %s" % cmd)
+
+
+
def p4CmdList(cmd):
cmd = "p4 -G %s" % cmd
pipe = os.popen(cmd, "rb")
def parseRevision(ref):
return read_pipe("git rev-parse %s" % ref)[:-1]
-def system(cmd):
- if os.system(cmd) != 0:
- die("command failed: %s" % cmd)
-
def extractLogMessageFromGitCommit(commit):
logMessage = ""
(a ... is not needed in the path p4 specification, it's added implicitly)"""
self.usage += " //depot/path[@revRange]"
-
self.silent = False
self.createdBranches = Set()
self.committedChanges = Set()
self.importIntoRemotes = True
self.maxChanges = ""
self.isWindows = (platform.system() == "Windows")
+ self.depotPath = None
if gitConfig("git-p4.syncFromOrigin") == "false":
self.syncWithOrigin = False
fnum = fnum + 1
return files
+ def stripRepoPath(self, path):
+ return path[len(self.depotPath):]
+
def splitFilesIntoBranches(self, commit):
branches = {}
-
fnum = 0
while commit.has_key("depotFile%s" % fnum):
path = commit["depotFile%s" % fnum]
file["type"] = commit["type%s" % fnum]
fnum = fnum + 1
- relPath = path[len(self.depotPath):]
+ relPath = self.stripRepoPath(path)
for branch in self.knownBranches.keys():
- if relPath.startswith(branch + "/"): # add a trailing slash so that a commit into qt/4.2foo doesn't end up in qt/4.2
+
+ # add a trailing slash so that a commit into qt/4.2foo doesn't end up in qt/4.2
+ if relPath.startswith(branch + "/"):
if branch not in branches:
branches[branch] = []
branches[branch].append(file)