5
5
FILES_COMMAND = 'hg locate -I .'
6
6
7
7
8
- def _hg_tagdist_normalize_tagcommit (root , tag , dist , node ):
8
+ def _hg_tagdist_normalize_tagcommit (root , tag , dist , node , branch ):
9
9
dirty = node .endswith ('+' )
10
10
node = 'h' + node .strip ('+' )
11
11
@@ -17,42 +17,44 @@ def _hg_tagdist_normalize_tagcommit(root, tag, dist, node):
17
17
" and not tag({tag!r}))" # ignore the tagged commit itself
18
18
).format (tag = tag )
19
19
if tag != '0.0' :
20
- commits = do (['hg' , 'log' , '-r' , revset , '--template' , '{node|short}' ],
20
+ commits = do (['hg' , 'log' , '-r' , revset ,
21
+ '--template' , '{node|short}' ],
21
22
root )
22
23
else :
23
24
commits = True
24
25
trace ('normalize' , locals ())
25
26
if commits or dirty :
26
- return meta (tag , distance = dist , node = node , dirty = dirty )
27
+ return meta (tag , distance = dist , node = node , dirty = dirty , branch = branch )
27
28
else :
28
29
return meta (tag )
29
30
30
31
31
32
def parse (root ):
32
33
if not has_command ('hg' ):
33
34
return
34
- identity_data = do ('hg id -i -t' , root ).split ()
35
+ identity_data = do ('hg id -i -b - t' , root ).split ()
35
36
if not identity_data :
36
37
return
37
38
node = identity_data .pop (0 )
39
+ branch = identity_data .pop (0 )
38
40
tags = tags_to_versions (identity_data )
39
41
# filter tip in degraded mode on old setuptools
40
42
tags = [x for x in tags if x != 'tip' ]
41
43
dirty = node [- 1 ] == '+'
42
44
if tags :
43
- return meta (tags [0 ], dirty = dirty )
45
+ return meta (tags [0 ], dirty = dirty , branch = branch )
44
46
45
- if node .strip ('+' ) == '0' * 12 :
47
+ if node .strip ('+' ) == '0' * 12 :
46
48
trace ('initial node' , root )
47
- return meta ('0.0' , dirty = dirty )
49
+ return meta ('0.0' , dirty = dirty , branch = branch )
48
50
49
51
try :
50
52
tag = get_latest_normalizable_tag (root )
51
53
dist = get_graph_distance (root , tag )
52
54
if tag == 'null' :
53
55
tag = '0.0'
54
56
dist = int (dist ) + 1
55
- return _hg_tagdist_normalize_tagcommit (root , tag , dist , node )
57
+ return _hg_tagdist_normalize_tagcommit (root , tag , dist , node , branch )
56
58
except ValueError :
57
59
pass # unpacking failed, old hg
58
60
0 commit comments