diff --git a/hgext/convert/cvs.py b/hgext/convert/cvs.py --- a/hgext/convert/cvs.py +++ b/hgext/convert/cvs.py @@ -153,7 +153,7 @@ class convert_cvs(converter_source): sck.send("\n".join(["BEGIN AUTH REQUEST", root, user, passw, "END AUTH REQUEST", ""])) if sck.recv(128) != "I LOVE YOU\n": - raise NoRepo("CVS pserver authentication failed") + raise util.Abort("CVS pserver authentication failed") self.writep = self.readp = sck.makefile('r+') diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -924,8 +924,6 @@ class queue: if line.startswith('diff --git'): self.diffopts().git = True break - patchf.seek(0) - patchf.truncate() msg = opts.get('msg', '').rstrip() if msg: @@ -940,6 +938,10 @@ class queue: ci += 1 del comments[ci] comments.append(msg) + + patchf.seek(0) + patchf.truncate() + if comments: comments = "\n".join(comments) + '\n\n' patchf.write(comments) diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -214,6 +214,9 @@ def clone(ui, source, dest=None, pull=Fa else: raise util.Abort(_("clone from remote to remote not supported")) + if dir_cleanup: + dir_cleanup.close() + if dest_repo.local(): fp = dest_repo.opener("hgrc", "w", text=True) fp.write("[paths]\n") @@ -226,8 +229,6 @@ def clone(ui, source, dest=None, pull=Fa except: checkout = dest_repo.changelog.tip() _update(dest_repo, checkout) - if dir_cleanup: - dir_cleanup.close() return src_repo, dest_repo finally: