mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
merge with crew
This commit is contained in:
commit
10700bb24c
@ -94,8 +94,8 @@ def _kwrestrict(cmd):
|
||||
'''Returns True if cmd should trigger restricted expansion.
|
||||
Keywords will only expanded when writing to working dir.
|
||||
Crucial for mq as expanded keywords should not make it into patches.'''
|
||||
return cmd in ('diff1',
|
||||
'qimport', 'qnew', 'qpush', 'qrefresh', 'record', 'qrecord')
|
||||
return cmd in ('diff1', 'record',
|
||||
'qfold', 'qimport', 'qnew', 'qpush', 'qrefresh', 'qrecord')
|
||||
|
||||
|
||||
_kwtemplater = None
|
||||
@ -310,7 +310,7 @@ def demo(ui, repo, *args, **opts):
|
||||
kwmaps = kwtemplater.templates
|
||||
if ui.configitems('keywordmaps'):
|
||||
# override maps from optional rcfile
|
||||
for k, v in kwmaps.items():
|
||||
for k, v in kwmaps.iteritems():
|
||||
ui.setconfig('keywordmaps', k, v)
|
||||
elif args:
|
||||
# simulate hgrc parsing
|
||||
@ -329,7 +329,7 @@ def demo(ui, repo, *args, **opts):
|
||||
demostatus('config using %s keyword template maps' % kwstatus)
|
||||
ui.write('[extensions]\n%s\n' % extension)
|
||||
demoitems('keyword', ui.configitems('keyword'))
|
||||
demoitems('keywordmaps', kwmaps.items())
|
||||
demoitems('keywordmaps', kwmaps.iteritems())
|
||||
keywords = '$' + '$\n$'.join(kwmaps.keys()) + '$\n'
|
||||
repo.wopener(fn, 'w').write(keywords)
|
||||
repo.add([fn])
|
||||
@ -464,10 +464,10 @@ def reposetup(ui, repo):
|
||||
wlock = self.wlock()
|
||||
lock = self.lock()
|
||||
# store and postpone commit hooks
|
||||
commithooks = []
|
||||
commithooks = {}
|
||||
for name, cmd in ui.configitems('hooks'):
|
||||
if name.split('.', 1)[0] == 'commit':
|
||||
commithooks.append((name, cmd))
|
||||
commithooks[name] = cmd
|
||||
ui.setconfig('hooks', name, None)
|
||||
if commithooks:
|
||||
# store parents for commit hook environment
|
||||
@ -488,7 +488,7 @@ def reposetup(ui, repo):
|
||||
p1=p1, p2=p2, extra=extra)
|
||||
|
||||
# restore commit hooks
|
||||
for name, cmd in commithooks:
|
||||
for name, cmd in commithooks.iteritems():
|
||||
ui.setconfig('hooks', name, cmd)
|
||||
if node is not None:
|
||||
_overwrite(ui, self, node=node)
|
||||
|
@ -381,7 +381,6 @@ def patchbomb(ui, repo, *revs, **opts):
|
||||
parent = None
|
||||
|
||||
sender_addr = email.Utils.parseaddr(sender)[1]
|
||||
sendmail = None
|
||||
for m in msgs:
|
||||
try:
|
||||
m['Message-Id'] = genmsgid(m['X-Mercurial-Node'])
|
||||
@ -426,12 +425,10 @@ def patchbomb(ui, repo, *revs, **opts):
|
||||
fp.write('\n\n')
|
||||
fp.close()
|
||||
else:
|
||||
if not sendmail:
|
||||
sendmail = mail.connect(ui)
|
||||
ui.status('Sending ', m['Subject'], ' ...\n')
|
||||
# Exim does not remove the Bcc field
|
||||
del m['Bcc']
|
||||
sendmail(ui, sender, to + bcc + cc, m.as_string(0))
|
||||
mail.sendmail(ui, sender, to + bcc + cc, m.as_string(0))
|
||||
|
||||
cmdtable = {
|
||||
"email":
|
||||
|
@ -38,43 +38,39 @@ def _smtp(ui):
|
||||
s.login(username, password)
|
||||
return s
|
||||
|
||||
def _sendmail(ui, sender, recipients, msg):
|
||||
class _sendmail(object):
|
||||
'''send mail using sendmail.'''
|
||||
program = ui.config('email', 'method')
|
||||
cmdline = '%s -f %s %s' % (program, templater.email(sender),
|
||||
' '.join(map(templater.email, recipients)))
|
||||
ui.note(_('sending mail: %s\n') % cmdline)
|
||||
fp = os.popen(cmdline, 'w')
|
||||
fp.write(msg)
|
||||
ret = fp.close()
|
||||
if ret:
|
||||
raise util.Abort('%s %s' % (
|
||||
os.path.basename(program.split(None, 1)[0]),
|
||||
util.explain_exit(ret)[0]))
|
||||
|
||||
def __init__(self, ui, program):
|
||||
self.ui = ui
|
||||
self.program = program
|
||||
|
||||
def sendmail(self, sender, recipients, msg):
|
||||
cmdline = '%s -f %s %s' % (
|
||||
self.program, templater.email(sender),
|
||||
' '.join(map(templater.email, recipients)))
|
||||
self.ui.note(_('sending mail: %s\n') % cmdline)
|
||||
fp = os.popen(cmdline, 'w')
|
||||
fp.write(msg)
|
||||
ret = fp.close()
|
||||
if ret:
|
||||
raise util.Abort('%s %s' % (
|
||||
os.path.basename(self.program.split(None, 1)[0]),
|
||||
util.explain_exit(ret)[0]))
|
||||
|
||||
def connect(ui):
|
||||
'''make a mail connection. return a function to send mail.
|
||||
'''make a mail connection. object returned has one method, sendmail.
|
||||
call as sendmail(sender, list-of-recipients, msg).'''
|
||||
|
||||
func = _sendmail
|
||||
if ui.config('email', 'method', 'smtp') == 'smtp':
|
||||
func = _smtp(ui)
|
||||
method = ui.config('email', 'method', 'smtp')
|
||||
if method == 'smtp':
|
||||
return _smtp(ui)
|
||||
|
||||
def send(ui, sender, recipients, msg):
|
||||
try:
|
||||
return func.sendmail(sender, recipients, msg)
|
||||
except smtplib.SMTPRecipientsRefused, inst:
|
||||
recipients = [r[1] for r in inst.recipients.values()]
|
||||
raise util.Abort('\n' + '\n'.join(recipients))
|
||||
except smtplib.SMTPException, inst:
|
||||
raise util.Abort(inst)
|
||||
|
||||
return send
|
||||
return _sendmail(ui, method)
|
||||
|
||||
def sendmail(ui, sender, recipients, msg):
|
||||
try:
|
||||
send = connect(ui)
|
||||
return send(sender, recipients, msg)
|
||||
return connect(ui).sendmail(sender, recipients, msg)
|
||||
except smtplib.SMTPRecipientsRefused, inst:
|
||||
recipients = [r[1] for r in inst.recipients.values()]
|
||||
raise util.Abort('\n' + '\n'.join(recipients))
|
||||
|
@ -204,7 +204,8 @@ class ui(object):
|
||||
pathsitems = items
|
||||
for n, path in pathsitems:
|
||||
if path and "://" not in path and not os.path.isabs(path):
|
||||
cdata.set("paths", n, os.path.join(root, path))
|
||||
cdata.set("paths", n,
|
||||
os.path.normpath(os.path.join(root, path)))
|
||||
|
||||
# update verbosity/interactive/report_untrusted settings
|
||||
if section is None or section == 'ui':
|
||||
|
@ -293,7 +293,7 @@ adding file changes
|
||||
added 1 changesets with 3 changes to 3 files
|
||||
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
% incoming
|
||||
comparing with test-keyword/Test-a/../Test
|
||||
comparing with test-keyword/Test
|
||||
searching for changes
|
||||
changeset: 1:0729690beff6
|
||||
tag: tip
|
||||
|
11
tests/test-paths
Executable file
11
tests/test-paths
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
base=`pwd`
|
||||
hg init a
|
||||
hg clone a b
|
||||
cd a
|
||||
echo '[paths]' >> .hg/hgrc
|
||||
echo 'dupe = ../b' >> .hg/hgrc
|
||||
hg in dupe | sed "s!$base!<base>!g"
|
||||
cd ..
|
||||
hg -R a in dupe | sed "s!$base!<base>!g"
|
||||
true
|
5
tests/test-paths.out
Normal file
5
tests/test-paths.out
Normal file
@ -0,0 +1,5 @@
|
||||
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
comparing with <base>/b
|
||||
no changes found
|
||||
comparing with <base>/b
|
||||
no changes found
|
Loading…
Reference in New Issue
Block a user