diff --git a/hgext/convert/darcs.py b/hgext/convert/darcs.py --- a/hgext/convert/darcs.py +++ b/hgext/convert/darcs.py @@ -36,6 +36,10 @@ class darcs_source(converter_source, com raise NoRepo("%s does not look like a darcs repo" % path) checktool('darcs') + version = self.run0('--version').splitlines()[0].strip() + if version < '2.1': + raise util.Abort(_('darcs version 2.1 or newer needed (found %r)') % + version) if ElementTree is None: raise util.Abort(_("Python ElementTree module is not available")) diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -138,7 +138,7 @@ def share(ui, source, dest=None, update= try: uprev = r.lookup(test) break - except: + except LookupError: continue _update(r, uprev) diff --git a/mercurial/mail.py b/mercurial/mail.py --- a/mercurial/mail.py +++ b/mercurial/mail.py @@ -36,7 +36,10 @@ def _smtp(ui): if username and password: ui.note(_('(authenticating to mail server as %s)\n') % (username)) - s.login(username, password) + try: + s.login(username, password) + except smtplib.SMTPException, inst: + raise util.Abort(inst) def send(sender, recipients, msg): try: diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -182,6 +182,7 @@ def readgitpatch(lr): lineno = 0 for line in lr: lineno += 1 + line = line.rstrip(' \r\n') if line.startswith('diff --git'): m = gitre.match(line) if m: @@ -200,23 +201,23 @@ def readgitpatch(lr): continue if line.startswith('rename from '): gp.op = 'RENAME' - gp.oldpath = line[12:].rstrip() + gp.oldpath = line[12:] elif line.startswith('rename to '): - gp.path = line[10:].rstrip() + gp.path = line[10:] elif line.startswith('copy from '): gp.op = 'COPY' - gp.oldpath = line[10:].rstrip() + gp.oldpath = line[10:] elif line.startswith('copy to '): - gp.path = line[8:].rstrip() + gp.path = line[8:] elif line.startswith('deleted file'): gp.op = 'DELETE' # is the deleted file a symlink? - gp.setmode(int(line.rstrip()[-6:], 8)) + gp.setmode(int(line[-6:], 8)) elif line.startswith('new file mode '): gp.op = 'ADD' - gp.setmode(int(line.rstrip()[-6:], 8)) + gp.setmode(int(line[-6:], 8)) elif line.startswith('new mode '): - gp.setmode(int(line.rstrip()[-6:], 8)) + gp.setmode(int(line[-6:], 8)) elif line.startswith('GIT binary patch'): dopatch |= GP_BINARY gp.binary = True diff --git a/tests/hghave b/tests/hghave --- a/tests/hghave +++ b/tests/hghave @@ -39,7 +39,7 @@ def has_bzr114(): try: import bzrlib return (bzrlib.__doc__ != None - and bzrlib.version_info[:2] == (1, 14)) + and bzrlib.version_info[:2] >= (1, 14)) except ImportError: return False