summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2007-05-23 21:49:35 (GMT)
committerHan-Wen Nienhuys <hanwen@google.com>2007-05-30 19:57:59 (GMT)
commit96e07dd23c570fe5e65e619c0f1e3c87be2a8352 (patch)
treea55f6c8a55627faba216e9a4fc53d6825df85299 /contrib
parenta3287be5bc40c1aa036eb5422db5a6a087d1736e (diff)
downloadgit-96e07dd23c570fe5e65e619c0f1e3c87be2a8352.zip
git-96e07dd23c570fe5e65e619c0f1e3c87be2a8352.tar.gz
git-96e07dd23c570fe5e65e619c0f1e3c87be2a8352.tar.bz2
read files before creating the commit.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/fast-import/git-p435
1 files changed, 21 insertions, 14 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 01efd92..d1989e6 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -697,6 +697,9 @@ class P4Sync(Command):
next_spec, next_info = specs[j+1]
end = data.find(next_spec, start)
+ if end < 0:
+ print spec, next_spec
+
assert end >= 0
else:
end = len(data)
@@ -712,6 +715,20 @@ class P4Sync(Command):
if self.verbose:
print "commit into %s" % branch
+ # start with reading files; if that fails, we should not
+ # create a commit.
+ new_files = []
+ for f in files:
+ if [p for p in branchPrefixes if f['path'].startswith(p)]:
+ new_files.append (f)
+ else:
+ sys.stderr.write("Ignoring file outside of prefix: %s\n" % path)
+ files = new_files
+ self.readP4Files(files)
+
+
+
+
self.gitStream.write("commit %s\n" % branch)
# gitStream.write("mark :%s\n" % details["change"])
self.committedChanges.add(int(details["change"]))
@@ -739,16 +756,6 @@ class P4Sync(Command):
print "parent %s" % parent
self.gitStream.write("from %s\n" % parent)
-
- new_files = []
- for f in files:
- if [p for p in branchPrefixes if f['path'].startswith(p)]:
- new_files.append (f)
- else:
- sys.stderr.write("Ignoring file outside of prefix: %s\n" % path)
- files = new_files
-
- self.readP4Files(files)
for file in files:
if file["type"] == "apple":
print "\nfile %s is a strange apple file that forks. Ignoring!" % file['path']
@@ -1030,9 +1037,6 @@ class P4Sync(Command):
settings = extractSettingsGitLog(logMsg)
- if self.verbose:
- print "path %s change %s" % (','.join(depotPaths), change)
-
self.readOptions(settings)
if (settings.has_key('depot-paths')
and settings.has_key ('change')):
@@ -1145,6 +1149,9 @@ class P4Sync(Command):
+ ' '.join(["%s...%s"
% (p, self.revision)
for p in self.depotPaths])):
+
+ if not info.has_key("change"):
+ print info
change = int(info["change"])
if change > newestRevision:
newestRevision = change
@@ -1154,7 +1161,7 @@ class P4Sync(Command):
#fileCnt = fileCnt + 1
continue
- for prop in [ "depotFile", "rev", "action", "type" ]:
+ for prop in ["depotFile", "rev", "action", "type" ]:
details["%s%s" % (prop, fileCnt)] = info[prop]
fileCnt = fileCnt + 1