mercurial/localrepo.py
changeset 31996 e6e1884df298
parent 31995 fe9c4d614600
child 32116 265782c4a400
child 33141 e9d325cfe071
equal deleted inserted replaced
31995:fe9c4d614600 31996:e6e1884df298
  1013         # For now, We gate the feature behind a flag since this likely comes
  1013         # For now, We gate the feature behind a flag since this likely comes
  1014         # with performance impacts. The current code run more often than needed
  1014         # with performance impacts. The current code run more often than needed
  1015         # and do not use caches as much as it could.  The current focus is on
  1015         # and do not use caches as much as it could.  The current focus is on
  1016         # the behavior of the feature so we disable it by default. The flag
  1016         # the behavior of the feature so we disable it by default. The flag
  1017         # will be removed when we are happy with the performance impact.
  1017         # will be removed when we are happy with the performance impact.
       
  1018         #
       
  1019         # Once this feature is no longer experimental move the following
       
  1020         # documentation to the appropriate help section:
       
  1021         #
       
  1022         # The ``HG_TAG_MOVED`` variable will be set if the transaction touched
       
  1023         # tags (new or changed or deleted tags). In addition the details of
       
  1024         # these changes are made available in a file at:
       
  1025         #     ``REPOROOT/.hg/changes/tags.changes``.
       
  1026         # Make sure you check for HG_TAG_MOVED before reading that file as it
       
  1027         # might exist from a previous transaction even if no tag were touched
       
  1028         # in this one. Changes are recorded in a line base format::
       
  1029         #
       
  1030         #     <action> <hex-node> <tag-name>\n
       
  1031         #
       
  1032         # Actions are defined as follow:
       
  1033         #   "-R": tag is removed,
       
  1034         #   "+A": tag is added,
       
  1035         #   "-M": tag is moved (old value),
       
  1036         #   "+M": tag is moved (new value),
  1018         tracktags = lambda x: None
  1037         tracktags = lambda x: None
  1019         # experimental config: experimental.hook-track-tags
  1038         # experimental config: experimental.hook-track-tags
  1020         shouldtracktags = self.ui.configbool('experimental', 'hook-track-tags',
  1039         shouldtracktags = self.ui.configbool('experimental', 'hook-track-tags',
  1021                                              False)
  1040                                              False)
  1022         if desc != 'strip' and shouldtracktags:
  1041         if desc != 'strip' and shouldtracktags:
  1029                 # notes: we compare lists here.
  1048                 # notes: we compare lists here.
  1030                 # As we do it only once buiding set would not be cheaper
  1049                 # As we do it only once buiding set would not be cheaper
  1031                 changes = tagsmod.difftags(repo.ui, repo, oldfnodes, newfnodes)
  1050                 changes = tagsmod.difftags(repo.ui, repo, oldfnodes, newfnodes)
  1032                 if changes:
  1051                 if changes:
  1033                     tr2.hookargs['tag_moved'] = '1'
  1052                     tr2.hookargs['tag_moved'] = '1'
       
  1053                     with repo.vfs('changes/tags.changes', 'w',
       
  1054                                   atomictemp=True) as changesfile:
       
  1055                         # note: we do not register the file to the transaction
       
  1056                         # because we needs it to still exist on the transaction
       
  1057                         # is close (for txnclose hooks)
       
  1058                         tagsmod.writediff(changesfile, changes)
  1034         def validate(tr2):
  1059         def validate(tr2):
  1035             """will run pre-closing hooks"""
  1060             """will run pre-closing hooks"""
  1036             # XXX the transaction API is a bit lacking here so we take a hacky
  1061             # XXX the transaction API is a bit lacking here so we take a hacky
  1037             # path for now
  1062             # path for now
  1038             #
  1063             #