[PATCH] hg tag: run tag hook just once

John Coomes John.Coomes at sun.com
Fri Jan 4 04:13:21 CST 2008


I (John.Coomes at sun.com) wrote:
> Here's the standalone patch to remove the extra call to the tag hook
> for global tags.
> ...

Here's the patch again, this time applied to the current hg-stable.
Let me know if anything else is needed (e.g., file a bug).

-John



# HG changeset patch
# User John Coomes <john.coomes at sun.com>
# Date 1199349494 28800
# Node ID dd749b747abb4718caf531bf08d557b2bdd15cd3
# Parent  ea1016b32e948f57cd3de4bcad248197e91e4d43
hg tag: run tag hook just once

diff -r ea1016b32e94 -r dd749b747abb mercurial/localrepo.py
--- a/mercurial/localrepo.py	Thu Dec 27 22:40:07 2007 -0600
+++ b/mercurial/localrepo.py	Thu Jan 03 00:38:14 2008 -0800
@@ -122,7 +122,6 @@ class localrepository(repo.repository):
                 fp.write('\n')
             fp.write('%s %s\n' % (hex(node), munge and munge(name) or name))
             fp.close()
-            self.hook('tag', node=hex(node), tag=name, local=local)
 
         prevtags = ''
         if local:
@@ -135,6 +134,7 @@ class localrepository(repo.repository):
 
             # local tags are stored in the current charset
             writetag(fp, name, None, prevtags)
+            self.hook('tag', node=hex(node), tag=name, local=local)
             return
 
         if use_dirstate:
diff -r ea1016b32e94 -r dd749b747abb tests/test-hook.out
--- a/tests/test-hook.out	Thu Dec 27 22:40:07 2007 -0600
+++ b/tests/test-hook.out	Thu Jan 03 00:38:14 2008 -0800
@@ -40,7 +40,6 @@ added 3 changesets with 2 changes to 2 f
 added 3 changesets with 2 changes to 2 files
 (run 'hg update' to get a working copy)
 pretag hook: HG_LOCAL=0 HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_TAG=a 
-tag hook: HG_LOCAL=0 HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_TAG=a 
 precommit hook: HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 
 pretxncommit hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 
 4:8ea2ef7ad3e8





More information about the Mercurial-devel mailing list