diff mercurial/cmdutil.py @ 37815:32a75a8a5b0f stable

import: fix crash on --exact check of empty commit (issue5702)
author Yuya Nishihara <yuya@tcha.org>
date Tue, 24 Apr 2018 21:29:00 +0900
parents f10cb49951e1
children 79c54e7c0c52 853001c84114
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Apr 24 08:20:15 2018 -0700
+++ b/mercurial/cmdutil.py	Tue Apr 24 21:29:00 2018 +0900
@@ -1537,7 +1537,7 @@
         # --exact with --no-commit is still useful in that it does merge
         # and branch bits
         ui.warn(_("warning: can't check exact import with --no-commit\n"))
-    elif opts.get('exact') and hex(n) != nodeid:
+    elif opts.get('exact') and (not n or hex(n) != nodeid):
         raise error.Abort(_('patch is damaged or loses information'))
     msg = _('applied to working directory')
     if n: