Patchwork [3,of,7] histedit: limit mentioning histedit-last-edit.txt

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 28, 2015, 11:29 p.m.
Message ID <816c85d7623101c8521f.1451345354@waste.org>
Download mbox | patch
Permalink /patch/12383/
State Accepted
Headers show

Comments

timeless@mozdev.org - Dec. 28, 2015, 11:29 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1449817689 0
#      Fri Dec 11 07:08:09 2015 +0000
# Node ID 816c85d7623101c8521f73520eeb6fdfb44741b3
# Parent  a019a4d808aaa8b517f834975ef93dc21fa021d4
histedit: limit mentioning histedit-last-edit.txt

Before histedit-last-edit.txt would be mentioned for any failure.
After, it should only be mentioned for failures relating to user
input.

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -902,11 +902,6 @@ 
         state.wlock = repo.wlock()
         state.lock = repo.lock()
         _histedit(ui, repo, state, *freeargs, **opts)
-    except error.Abort:
-        if repo.vfs.exists('histedit-last-edit.txt'):
-            ui.warn(_('warning: histedit rules saved '
-                      'to: .hg/histedit-last-edit.txt\n'))
-        raise
     finally:
         release(state.lock, state.wlock)
 
@@ -987,7 +982,7 @@ 
         actions = parserules(rules, state)
         ctxs = [repo[act.nodetoverify()] \
                 for act in state.actions if act.nodetoverify()]
-        verifyactions(actions, state, ctxs)
+        warnverifyactions(ui, repo, actions, state, ctxs)
         state.actions = actions
         state.write()
         return
@@ -1070,7 +1065,7 @@ 
             rules = f.read()
             f.close()
         actions = parserules(rules, state)
-        verifyactions(actions, state, ctxs)
+        warnverifyactions(ui, repo, actions, state, ctxs)
 
         parentctxnode = repo[root].parents()[0].node()
 
@@ -1222,6 +1217,15 @@ 
         actions.append(action)
     return actions
 
+def warnverifyactions(ui, repo, actions, state, ctxs):
+    try:
+        verifyactions(actions, state, ctxs)
+    except error.Abort:
+        if repo.vfs.exists('histedit-last-edit.txt'):
+            ui.warn(_('warning: histedit rules saved '
+                      'to: .hg/histedit-last-edit.txt\n'))
+        raise
+
 def verifyactions(actions, state, ctxs):
     """Verify that there exists exactly one action per given changeset and
     other constraints.