comparison mercurial/tags.py @ 21814:5125856a28cf

tags: read tag info into a sorted dict (rather than into a regular dict) This lets us preserve the original tag order (as specified on the .hgtags file that is being read). This will be useful to preserve the tag order when saving the result of a successful automated .hgtags merge (which will be introduced on a future patch). There shouldn't be much impact on performance because the sortdict that _readtags returns is then used to update the alltags regular dict (which remains a regular dict).
author Angel Ezquerra <angel.ezquerra@gmail.com>
date Sun, 23 Feb 2014 03:13:21 +0100
parents 9ea132aee96c
children 4b93e19cd6e6
comparison
equal deleted inserted replaced
21813:c2262004c2e2 21814:5125856a28cf
10 # Eventually, it could take care of updating (adding/removing/moving) 10 # Eventually, it could take care of updating (adding/removing/moving)
11 # tags too. 11 # tags too.
12 12
13 from node import nullid, bin, hex, short 13 from node import nullid, bin, hex, short
14 from i18n import _ 14 from i18n import _
15 import util
15 import encoding 16 import encoding
16 import error 17 import error
17 import errno 18 import errno
18 import time 19 import time
19 20
79 Return a mapping from tag name to (node, hist): node is the node id 80 Return a mapping from tag name to (node, hist): node is the node id
80 from the last line read for that name, and hist is the list of node 81 from the last line read for that name, and hist is the list of node
81 ids previously associated with it (in file order). All node ids are 82 ids previously associated with it (in file order). All node ids are
82 binary, not hex.''' 83 binary, not hex.'''
83 84
84 filetags = {} # map tag name to (node, hist) 85 filetags = util.sortdict() # map tag name to (node, hist)
85 count = 0 86 count = 0
86 87
87 def warn(msg): 88 def warn(msg):
88 ui.warn(_("%s, line %s: %s\n") % (fn, count, msg)) 89 ui.warn(_("%s, line %s: %s\n") % (fn, count, msg))
89 90