summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorLibravatar Han-Wen Nienhuys <hanwen@google.com>2007-05-23 17:14:33 -0300
committerLibravatar Han-Wen Nienhuys <hanwen@google.com>2007-05-28 11:15:43 -0300
commitbce4c5fc0b6aa9e599fc181c5350b461dafecee2 (patch)
tree0b13c30827f7d5ea4d32e70d755f2f0cb3d1c35b /contrib
parentRobustness fixes for pipes (diff)
downloadtgif-bce4c5fc0b6aa9e599fc181c5350b461dafecee2.tar.xz
cleanup
- use re.sub() iso. if for stripping ... - spacing nits Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/fast-import/git-p440
1 files changed, 19 insertions, 21 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 05b308f5be..8d649dd762 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -16,39 +16,39 @@ from sets import Set;
gitdir = os.environ.get("GIT_DIR", "")
silent = False
-def write_pipe (c, str):
+def write_pipe(c, str):
if not silent:
- sys.stderr.write ('writing pipe: %s\n' % c)
+ sys.stderr.write('writing pipe: %s\n' % c)
## todo: check return status
- pipe = os.popen (c, 'w')
+ pipe = os.popen(c, 'w')
val = pipe.write(str)
- if pipe.close ():
- sys.stderr.write ('Command failed')
- sys.exit (1)
+ if pipe.close():
+ sys.stderr.write('Command failed')
+ sys.exit(1)
return val
-def read_pipe (c):
- sys.stderr.write ('reading pipe: %s\n' % c)
+def read_pipe(c):
+ sys.stderr.write('reading pipe: %s\n' % c)
## todo: check return status
- pipe = os.popen (c, 'rb')
+ pipe = os.popen(c, 'rb')
val = pipe.read()
- if pipe.close ():
- sys.stderr.write ('Command failed')
- sys.exit (1)
+ if pipe.close():
+ sys.stderr.write('Command failed')
+ sys.exit(1)
return val
-def read_pipe_lines (c):
- sys.stderr.write ('reading pipe: %s\n' % c)
+def read_pipe_lines(c):
+ sys.stderr.write('reading pipe: %s\n' % c)
## todo: check return status
- pipe = os.popen (c, 'rb')
+ pipe = os.popen(c, 'rb')
val = pipe.readlines()
- if pipe.close ():
- sys.stderr.write ('Command failed')
- sys.exit (1)
+ if pipe.close():
+ sys.stderr.write('Command failed')
+ sys.exit(1)
return val
@@ -986,9 +986,7 @@ class P4Sync(Command):
elif len(self.previousDepotPath) == 0:
self.revision = "#head"
- if self.depotPath.endswith("..."):
- self.depotPath = self.depotPath[:-3]
-
+ self.depotPath = re.sub ("\.\.\.$", "", self.depotPath)
if not self.depotPath.endswith("/"):
self.depotPath += "/"