[PATCH 07 of 10] histedit: ensure rules return short hex at all time

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Thu Apr 18 10:29:22 CDT 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1366290601 -7200
#      Thu Apr 18 15:10:01 2013 +0200
# Node ID 25fec4235b7161d2952dd4ad354e16a58f3708af
# Parent  bba287fd0cbf99b1ee8a5297a054b7100f9338b4
histedit: ensure rules return short hex at all time

Handling homogeneous data is both simpler and safer.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -722,15 +722,16 @@ def verifyrules(rules, repo, ctxs):
         if ' ' not in r:
             raise util.Abort(_('malformed line "%s"') % r)
         action, rest = r.split(' ', 1)
         ha = rest.strip().split(' ', 1)[0]
         try:
-            if repo[ha] not in ctxs:
-                raise util.Abort(
-                    _('may not use changesets other than the ones listed'))
+            ha = str(repo[ha])  # ensure its a short hash
         except error.RepoError:
             raise util.Abort(_('unknown changeset %s listed') % ha)
+        if repo[ha] not in ctxs:
+            raise util.Abort(
+                _('may not use changesets other than the ones listed'))
         if action not in actiontable:
             raise util.Abort(_('unknown action "%s"') % action)
         parsed.append([action, ha])
     return parsed
 


More information about the Mercurial-devel mailing list