mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
Merge with crew-stable
This commit is contained in:
commit
90a7d714cf
@ -46,14 +46,13 @@ class convert_cvs(converter_source):
|
|||||||
cmd = '%s -d "1970/01/01 00:00:01" -d "%s"' % (cmd, self.rev)
|
cmd = '%s -d "1970/01/01 00:00:01" -d "%s"' % (cmd, self.rev)
|
||||||
except util.Abort:
|
except util.Abort:
|
||||||
raise util.Abort('revision %s is not a patchset number or date' % self.rev)
|
raise util.Abort('revision %s is not a patchset number or date' % self.rev)
|
||||||
cmd += " 2>&1"
|
|
||||||
|
|
||||||
d = os.getcwd()
|
d = os.getcwd()
|
||||||
try:
|
try:
|
||||||
os.chdir(self.path)
|
os.chdir(self.path)
|
||||||
id = None
|
id = None
|
||||||
state = 0
|
state = 0
|
||||||
for l in os.popen(cmd):
|
for l in util.popen(cmd):
|
||||||
if state == 0: # header
|
if state == 0: # header
|
||||||
if l.startswith("PatchSet"):
|
if l.startswith("PatchSet"):
|
||||||
id = l[9:-2]
|
id = l[9:-2]
|
||||||
|
@ -67,9 +67,9 @@ class darcs_source(converter_source):
|
|||||||
cmdline += args
|
cmdline += args
|
||||||
cmdline = [util.shellquote(arg) for arg in cmdline]
|
cmdline = [util.shellquote(arg) for arg in cmdline]
|
||||||
cmdline += ['<', util.nulldev]
|
cmdline += ['<', util.nulldev]
|
||||||
cmdline = util.quotecommand(' '.join(cmdline))
|
cmdline = ' '.join(cmdline)
|
||||||
self.ui.debug(cmdline, '\n')
|
self.ui.debug(cmdline, '\n')
|
||||||
return os.popen(cmdline, 'r')
|
return util.popen(cmdline)
|
||||||
|
|
||||||
def run(self, cmd, *args, **kwargs):
|
def run(self, cmd, *args, **kwargs):
|
||||||
fp = self._run(cmd, *args, **kwargs)
|
fp = self._run(cmd, *args, **kwargs)
|
||||||
|
@ -14,7 +14,7 @@ class convert_git(converter_source):
|
|||||||
prevgitdir = os.environ.get('GIT_DIR')
|
prevgitdir = os.environ.get('GIT_DIR')
|
||||||
os.environ['GIT_DIR'] = self.path
|
os.environ['GIT_DIR'] = self.path
|
||||||
try:
|
try:
|
||||||
return os.popen(s)
|
return util.popen(s)
|
||||||
finally:
|
finally:
|
||||||
if prevgitdir is None:
|
if prevgitdir is None:
|
||||||
del os.environ['GIT_DIR']
|
del os.environ['GIT_DIR']
|
||||||
@ -22,7 +22,7 @@ class convert_git(converter_source):
|
|||||||
os.environ['GIT_DIR'] = prevgitdir
|
os.environ['GIT_DIR'] = prevgitdir
|
||||||
else:
|
else:
|
||||||
def gitcmd(self, s):
|
def gitcmd(self, s):
|
||||||
return os.popen('GIT_DIR=%s %s' % (self.path, s))
|
return util.popen('GIT_DIR=%s %s' % (self.path, s))
|
||||||
|
|
||||||
def __init__(self, ui, path, rev=None):
|
def __init__(self, ui, path, rev=None):
|
||||||
super(convert_git, self).__init__(ui, path, rev=rev)
|
super(convert_git, self).__init__(ui, path, rev=rev)
|
||||||
@ -45,8 +45,7 @@ class convert_git(converter_source):
|
|||||||
|
|
||||||
def catfile(self, rev, type):
|
def catfile(self, rev, type):
|
||||||
if rev == "0" * 40: raise IOError()
|
if rev == "0" * 40: raise IOError()
|
||||||
fh = self.gitcmd("git-cat-file %s %s 2>%s" % (type, rev,
|
fh = self.gitcmd("git-cat-file %s %s" % (type, rev))
|
||||||
util.nulldev))
|
|
||||||
return fh.read()
|
return fh.read()
|
||||||
|
|
||||||
def getfile(self, name, rev):
|
def getfile(self, name, rev):
|
||||||
@ -111,8 +110,7 @@ class convert_git(converter_source):
|
|||||||
|
|
||||||
def gettags(self):
|
def gettags(self):
|
||||||
tags = {}
|
tags = {}
|
||||||
fh = self.gitcmd('git-ls-remote --tags "%s" 2>%s' % (self.path,
|
fh = self.gitcmd('git-ls-remote --tags "%s"' % self.path)
|
||||||
util.nulldev))
|
|
||||||
prefix = 'refs/tags/'
|
prefix = 'refs/tags/'
|
||||||
for line in fh:
|
for line in fh:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
@ -256,7 +256,7 @@ class httprepository(remoterepository):
|
|||||||
if user:
|
if user:
|
||||||
ui.debug(_('http auth: user %s, password %s\n') %
|
ui.debug(_('http auth: user %s, password %s\n') %
|
||||||
(user, passwd and '*' * len(passwd) or 'not set'))
|
(user, passwd and '*' * len(passwd) or 'not set'))
|
||||||
passmgr.add_password(None, self._url, user, passwd or '')
|
passmgr.add_password(None, host, user, passwd or '')
|
||||||
|
|
||||||
handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr),
|
handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr),
|
||||||
httpdigestauthhandler(passmgr)))
|
httpdigestauthhandler(passmgr)))
|
||||||
|
@ -249,7 +249,7 @@ def externalpatch(patcher, args, patchname, ui, strip, cwd, files):
|
|||||||
fuzz = False
|
fuzz = False
|
||||||
if cwd:
|
if cwd:
|
||||||
args.append('-d %s' % util.shellquote(cwd))
|
args.append('-d %s' % util.shellquote(cwd))
|
||||||
fp = os.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip,
|
fp = util.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip,
|
||||||
util.shellquote(patchname)))
|
util.shellquote(patchname)))
|
||||||
|
|
||||||
for line in fp:
|
for line in fp:
|
||||||
|
@ -1011,6 +1011,13 @@ if os.name == 'nt':
|
|||||||
# through the current COMSPEC. cmd.exe suppress enclosing quotes.
|
# through the current COMSPEC. cmd.exe suppress enclosing quotes.
|
||||||
return '"' + cmd + '"'
|
return '"' + cmd + '"'
|
||||||
|
|
||||||
|
def popen(command):
|
||||||
|
# Work around "popen spawned process may not write to stdout
|
||||||
|
# under windows"
|
||||||
|
# http://bugs.python.org/issue1366
|
||||||
|
command += " 2> %s" % nulldev
|
||||||
|
return os.popen(quotecommand(command))
|
||||||
|
|
||||||
def explain_exit(code):
|
def explain_exit(code):
|
||||||
return _("exited with status %d") % code, code
|
return _("exited with status %d") % code, code
|
||||||
|
|
||||||
@ -1168,6 +1175,9 @@ else:
|
|||||||
def quotecommand(cmd):
|
def quotecommand(cmd):
|
||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
|
def popen(command):
|
||||||
|
return os.popen(command)
|
||||||
|
|
||||||
def testpid(pid):
|
def testpid(pid):
|
||||||
'''return False if pid dead, True if running or not sure'''
|
'''return False if pid dead, True if running or not sure'''
|
||||||
if os.sys.platform == 'OpenVMS':
|
if os.sys.platform == 'OpenVMS':
|
||||||
|
@ -50,7 +50,7 @@ def remember_version(version=None):
|
|||||||
"""Store version information."""
|
"""Store version information."""
|
||||||
global remembered_version
|
global remembered_version
|
||||||
if not version and os.path.isdir(".hg"):
|
if not version and os.path.isdir(".hg"):
|
||||||
f = os.popen("hg identify 2> %s" % util.nulldev) # use real hg installation
|
f = util.popen("hg identify") # use real hg installation
|
||||||
ident = f.read()[:-1]
|
ident = f.read()[:-1]
|
||||||
if not f.close() and ident:
|
if not f.close() and ident:
|
||||||
ids = ident.split(' ', 1)
|
ids = ident.split(' ', 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user