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

login
register
mail settings
Submitter Pierre-Yves David
Date April 18, 2013, 3:29 p.m.
Message ID <25fec4235b7161d2952d.1366298962@crater2.logilab.fr>
Download mbox | patch
Permalink /patch/1419/
State Accepted
Commit 080b801c34f1d053c3550a4f57b96ca3633e7e6f
Headers show

Comments

Pierre-Yves David - April 18, 2013, 3:29 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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