##// END OF EJS Templates
Merge with crew-stable
Patrick Mezard -
r5498:4d38e697 merge default
parent child Browse files
Show More
@@ -46,14 +46,13 b' class convert_cvs(converter_source):'
46 cmd = '%s -d "1970/01/01 00:00:01" -d "%s"' % (cmd, self.rev)
46 cmd = '%s -d "1970/01/01 00:00:01" -d "%s"' % (cmd, self.rev)
47 except util.Abort:
47 except util.Abort:
48 raise util.Abort('revision %s is not a patchset number or date' % self.rev)
48 raise util.Abort('revision %s is not a patchset number or date' % self.rev)
49 cmd += " 2>&1"
50
49
51 d = os.getcwd()
50 d = os.getcwd()
52 try:
51 try:
53 os.chdir(self.path)
52 os.chdir(self.path)
54 id = None
53 id = None
55 state = 0
54 state = 0
56 for l in os.popen(cmd):
55 for l in util.popen(cmd):
57 if state == 0: # header
56 if state == 0: # header
58 if l.startswith("PatchSet"):
57 if l.startswith("PatchSet"):
59 id = l[9:-2]
58 id = l[9:-2]
@@ -67,9 +67,9 b' class darcs_source(converter_source):'
67 cmdline += args
67 cmdline += args
68 cmdline = [util.shellquote(arg) for arg in cmdline]
68 cmdline = [util.shellquote(arg) for arg in cmdline]
69 cmdline += ['<', util.nulldev]
69 cmdline += ['<', util.nulldev]
70 cmdline = util.quotecommand(' '.join(cmdline))
70 cmdline = ' '.join(cmdline)
71 self.ui.debug(cmdline, '\n')
71 self.ui.debug(cmdline, '\n')
72 return os.popen(cmdline, 'r')
72 return util.popen(cmdline)
73
73
74 def run(self, cmd, *args, **kwargs):
74 def run(self, cmd, *args, **kwargs):
75 fp = self._run(cmd, *args, **kwargs)
75 fp = self._run(cmd, *args, **kwargs)
@@ -14,7 +14,7 b' class convert_git(converter_source):'
14 prevgitdir = os.environ.get('GIT_DIR')
14 prevgitdir = os.environ.get('GIT_DIR')
15 os.environ['GIT_DIR'] = self.path
15 os.environ['GIT_DIR'] = self.path
16 try:
16 try:
17 return os.popen(s)
17 return util.popen(s)
18 finally:
18 finally:
19 if prevgitdir is None:
19 if prevgitdir is None:
20 del os.environ['GIT_DIR']
20 del os.environ['GIT_DIR']
@@ -22,7 +22,7 b' class convert_git(converter_source):'
22 os.environ['GIT_DIR'] = prevgitdir
22 os.environ['GIT_DIR'] = prevgitdir
23 else:
23 else:
24 def gitcmd(self, s):
24 def gitcmd(self, s):
25 return os.popen('GIT_DIR=%s %s' % (self.path, s))
25 return util.popen('GIT_DIR=%s %s' % (self.path, s))
26
26
27 def __init__(self, ui, path, rev=None):
27 def __init__(self, ui, path, rev=None):
28 super(convert_git, self).__init__(ui, path, rev=rev)
28 super(convert_git, self).__init__(ui, path, rev=rev)
@@ -45,8 +45,7 b' class convert_git(converter_source):'
45
45
46 def catfile(self, rev, type):
46 def catfile(self, rev, type):
47 if rev == "0" * 40: raise IOError()
47 if rev == "0" * 40: raise IOError()
48 fh = self.gitcmd("git-cat-file %s %s 2>%s" % (type, rev,
48 fh = self.gitcmd("git-cat-file %s %s" % (type, rev))
49 util.nulldev))
50 return fh.read()
49 return fh.read()
51
50
52 def getfile(self, name, rev):
51 def getfile(self, name, rev):
@@ -111,8 +110,7 b' class convert_git(converter_source):'
111
110
112 def gettags(self):
111 def gettags(self):
113 tags = {}
112 tags = {}
114 fh = self.gitcmd('git-ls-remote --tags "%s" 2>%s' % (self.path,
113 fh = self.gitcmd('git-ls-remote --tags "%s"' % self.path)
115 util.nulldev))
116 prefix = 'refs/tags/'
114 prefix = 'refs/tags/'
117 for line in fh:
115 for line in fh:
118 line = line.strip()
116 line = line.strip()
@@ -256,7 +256,7 b' class httprepository(remoterepository):'
256 if user:
256 if user:
257 ui.debug(_('http auth: user %s, password %s\n') %
257 ui.debug(_('http auth: user %s, password %s\n') %
258 (user, passwd and '*' * len(passwd) or 'not set'))
258 (user, passwd and '*' * len(passwd) or 'not set'))
259 passmgr.add_password(None, self._url, user, passwd or '')
259 passmgr.add_password(None, host, user, passwd or '')
260
260
261 handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr),
261 handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr),
262 httpdigestauthhandler(passmgr)))
262 httpdigestauthhandler(passmgr)))
@@ -249,7 +249,7 b' def externalpatch(patcher, args, patchna'
249 fuzz = False
249 fuzz = False
250 if cwd:
250 if cwd:
251 args.append('-d %s' % util.shellquote(cwd))
251 args.append('-d %s' % util.shellquote(cwd))
252 fp = os.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip,
252 fp = util.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip,
253 util.shellquote(patchname)))
253 util.shellquote(patchname)))
254
254
255 for line in fp:
255 for line in fp:
@@ -1011,6 +1011,13 b" if os.name == 'nt':"
1011 # through the current COMSPEC. cmd.exe suppress enclosing quotes.
1011 # through the current COMSPEC. cmd.exe suppress enclosing quotes.
1012 return '"' + cmd + '"'
1012 return '"' + cmd + '"'
1013
1013
1014 def popen(command):
1015 # Work around "popen spawned process may not write to stdout
1016 # under windows"
1017 # http://bugs.python.org/issue1366
1018 command += " 2> %s" % nulldev
1019 return os.popen(quotecommand(command))
1020
1014 def explain_exit(code):
1021 def explain_exit(code):
1015 return _("exited with status %d") % code, code
1022 return _("exited with status %d") % code, code
1016
1023
@@ -1168,6 +1175,9 b' else:'
1168 def quotecommand(cmd):
1175 def quotecommand(cmd):
1169 return cmd
1176 return cmd
1170
1177
1178 def popen(command):
1179 return os.popen(command)
1180
1171 def testpid(pid):
1181 def testpid(pid):
1172 '''return False if pid dead, True if running or not sure'''
1182 '''return False if pid dead, True if running or not sure'''
1173 if os.sys.platform == 'OpenVMS':
1183 if os.sys.platform == 'OpenVMS':
@@ -50,7 +50,7 b' def remember_version(version=None):'
50 """Store version information."""
50 """Store version information."""
51 global remembered_version
51 global remembered_version
52 if not version and os.path.isdir(".hg"):
52 if not version and os.path.isdir(".hg"):
53 f = os.popen("hg identify 2> %s" % util.nulldev) # use real hg installation
53 f = util.popen("hg identify") # use real hg installation
54 ident = f.read()[:-1]
54 ident = f.read()[:-1]
55 if not f.close() and ident:
55 if not f.close() and ident:
56 ids = ident.split(' ', 1)
56 ids = ident.split(' ', 1)
General Comments 0
You need to be logged in to leave comments. Login now