summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-03-23 00:02:06 -0700
committerJunio C Hamano <gitster@pobox.com>2008-03-23 00:02:06 -0700
commitdc96bdb9469632fcb29f660d18a96fede99fcea2 (patch)
tree8d86a8f116a32005f8ad0bf158ddc49f9eda17b8 /contrib
parent46220ca100cfbcdd7d80a5ac3326c52a3e98dddb (diff)
parent82cea9ffb1c4677155e3e2996d76542502611370 (diff)
downloadgit-dc96bdb9469632fcb29f660d18a96fede99fcea2.tar.gz
Merge branch 'git-p4' of git://repo.or.cz/git/git-p4
* 'git-p4' of git://repo.or.cz/git/git-p4: git-p4: Use P4EDITOR environment variable when set git-p4: Unset P4DIFF environment variable when using 'p4 -du diff' git-p4: Optimize the fetching of data from perforce.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/fast-import/git-p423
1 files changed, 14 insertions, 9 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 650ea34176..3cb0330ec2 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -627,6 +627,8 @@ class P4Submit(Command):
if self.interactive:
submitTemplate = self.prepareLogMessage(template, logMessage)
+ if os.environ.has_key("P4DIFF"):
+ del(os.environ["P4DIFF"])
diff = read_pipe("p4 diff -du ...")
for newFile in filesToAdd:
@@ -650,7 +652,10 @@ class P4Submit(Command):
defaultEditor = "vi"
if platform.system() == "Windows":
defaultEditor = "notepad"
- editor = os.environ.get("EDITOR", defaultEditor);
+ if os.environ.has_key("P4EDITOR"):
+ editor = os.environ.get("P4EDITOR")
+ else:
+ editor = os.environ.get("EDITOR", defaultEditor);
system(editor + " " + fileName)
tmpFile = open(fileName, "rb")
message = tmpFile.read()
@@ -882,21 +887,21 @@ class P4Sync(Command):
while j < len(filedata):
stat = filedata[j]
j += 1
- text = ''
+ text = [];
while j < len(filedata) and filedata[j]['code'] in ('text', 'unicode', 'binary'):
- tmp = filedata[j]['data']
- if stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):
- tmp = re.sub(r'(?i)\$(Id|Header):[^$]*\$',r'$\1$', tmp)
- elif stat['type'] in ('text+k', 'ktext', 'kxtext', 'unicode+k', 'binary+k'):
- tmp = re.sub(r'(?i)\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\$',r'$\1$', tmp)
- text += tmp
+ text.append(filedata[j]['data'])
j += 1
-
+ text = ''.join(text)
if not stat.has_key('depotFile'):
sys.stderr.write("p4 print fails with: %s\n" % repr(stat))
continue
+ if stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):
+ text = re.sub(r'(?i)\$(Id|Header):[^$]*\$',r'$\1$', text)
+ elif stat['type'] in ('text+k', 'ktext', 'kxtext', 'unicode+k', 'binary+k'):
+ text = re.sub(r'(?i)\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\$',r'$\1$', text)
+
contents[stat['depotFile']] = text
for f in filesForCommit: