1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-07 22:26:11 +02:00
- use re.sub() iso. if for stripping ...
- spacing nits

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
This commit is contained in:
Han-Wen Nienhuys 2007-05-23 17:14:33 -03:00
parent b016d39756
commit bce4c5fc0b

View File

@ -16,39 +16,39 @@ from sets import Set;
gitdir = os.environ.get("GIT_DIR", "") gitdir = os.environ.get("GIT_DIR", "")
silent = False silent = False
def write_pipe (c, str): def write_pipe(c, str):
if not silent: if not silent:
sys.stderr.write ('writing pipe: %s\n' % c) sys.stderr.write('writing pipe: %s\n' % c)
## todo: check return status ## todo: check return status
pipe = os.popen (c, 'w') pipe = os.popen(c, 'w')
val = pipe.write(str) val = pipe.write(str)
if pipe.close (): if pipe.close():
sys.stderr.write ('Command failed') sys.stderr.write('Command failed')
sys.exit (1) sys.exit(1)
return val return val
def read_pipe (c): def read_pipe(c):
sys.stderr.write ('reading pipe: %s\n' % c) sys.stderr.write('reading pipe: %s\n' % c)
## todo: check return status ## todo: check return status
pipe = os.popen (c, 'rb') pipe = os.popen(c, 'rb')
val = pipe.read() val = pipe.read()
if pipe.close (): if pipe.close():
sys.stderr.write ('Command failed') sys.stderr.write('Command failed')
sys.exit (1) sys.exit(1)
return val return val
def read_pipe_lines (c): def read_pipe_lines(c):
sys.stderr.write ('reading pipe: %s\n' % c) sys.stderr.write('reading pipe: %s\n' % c)
## todo: check return status ## todo: check return status
pipe = os.popen (c, 'rb') pipe = os.popen(c, 'rb')
val = pipe.readlines() val = pipe.readlines()
if pipe.close (): if pipe.close():
sys.stderr.write ('Command failed') sys.stderr.write('Command failed')
sys.exit (1) sys.exit(1)
return val return val
@ -986,9 +986,7 @@ class P4Sync(Command):
elif len(self.previousDepotPath) == 0: elif len(self.previousDepotPath) == 0:
self.revision = "#head" self.revision = "#head"
if self.depotPath.endswith("..."): self.depotPath = re.sub ("\.\.\.$", "", self.depotPath)
self.depotPath = self.depotPath[:-3]
if not self.depotPath.endswith("/"): if not self.depotPath.endswith("/"):
self.depotPath += "/" self.depotPath += "/"