histedit: remove all usages of hex[:12]
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 26 Sep 2012 12:57:23 +0200
changeset 17662 4f2390e3f4b0
parent 17661 67deea9c1c42
child 17663 c6de8c696644
histedit: remove all usages of hex[:12] - `node.hex(n)[:12]` is the same as `node.short(n)` - `ctx.hex()[:12]` is the same as `str(ctx)`
hgext/histedit.py
--- a/hgext/histedit.py	Thu Sep 27 15:51:14 2012 -0500
+++ b/hgext/histedit.py	Wed Sep 26 12:57:23 2012 +0200
@@ -483,9 +483,9 @@
         ui.debug('restore wc to old tip %s\n' % node.hex(tip))
         hg.clean(repo, tip)
         ui.debug('should strip created nodes %s\n' %
-                 ', '.join([node.hex(n)[:12] for n in created]))
+                 ', '.join([node.short(n) for n in created]))
         ui.debug('should strip temp nodes %s\n' %
-                 ', '.join([node.hex(n)[:12] for n in tmpnodes]))
+                 ', '.join([node.short(n) for n in tmpnodes]))
         for nodes in (created, tmpnodes):
             lock = None
             try:
@@ -521,7 +521,7 @@
         if not rules:
             rules = '\n'.join([makedesc(c) for c in ctxs])
             rules += '\n\n'
-            rules += editcomment % (node.hex(parent)[:12], node.hex(tip)[:12])
+            rules += editcomment % (node.short(parent), node.short(tip))
             rules = ui.edit(rules, ui.username())
             # Save edit rules in .hg/histedit-last-edit.txt in case
             # the user needs to ask for help after something
@@ -636,7 +636,7 @@
                 # TODO update mq state
 
         ui.debug('should strip replaced nodes %s\n' %
-                 ', '.join([node.hex(n)[:12] for n in replaced]))
+                 ', '.join([node.short(n) for n in replaced]))
         lock = None
         try:
             lock = repo.lock()
@@ -649,7 +649,7 @@
             lockmod.release(lock)
 
     ui.debug('should strip temp nodes %s\n' %
-             ', '.join([node.hex(n)[:12] for n in tmpnodes]))
+             ', '.join([node.short(n) for n in tmpnodes]))
     lock = None
     try:
         lock = repo.lock()
@@ -713,7 +713,7 @@
     summary = ''
     if c.description():
         summary = c.description().splitlines()[0]
-    line = 'pick %s %d %s' % (c.hex()[:12], c.rev(), summary)
+    line = 'pick %s %d %s' % (c, c.rev(), summary)
     return line[:80]  # trim to 80 chars so it's not stupidly wide in my editor
 
 def verifyrules(rules, repo, ctxs):