@@ -803,10 +803,9 @@ def getbranches(rev=None, ret_rev=False):
803
803
result = []
804
804
refs = Git .getrefs ()
805
805
for ref in refs :
806
- m = re .match (r'^(.+)\s+(.+)$' , ref )
806
+ m = re .match (r'^(.+)\s+refs\/(heads|remotes)\/ (.+)$' , ref )
807
807
if m and (not rev or m .group (1 ).startswith (rev )):
808
- if re .match (r'refs\/(heads|remotes)\/' , m .group (2 )): # exclude tags
809
- result .append (m .group (1 ) if ret_rev else re .sub (r'refs\/(heads|remotes)\/' , '' , m .group (2 )))
808
+ result .append (m .group (1 ) if ret_rev else m .group (3 ))
810
809
return result
811
810
812
811
# Finds tags. Will match rev if specified
@@ -2164,9 +2163,9 @@ def sync(recursive=True, keep_refs=False, top=True):
2164
2163
def list_ (detailed = False , prefix = '' , p_path = None , ignore = False ):
2165
2164
repo = Repo .fromrepo ()
2166
2165
revtags = repo .scm .gettags (repo .rev ) if repo .rev else []
2167
- revstr = ('#' + repo .rev [:12 ]+ (', tags: ' + ', ' .join (revtags [0 :2 ]) if len (revtags ) else '' )) if repo .rev else ''
2166
+ revstr = ('#' + repo .rev [:12 ] + (', tags: ' + ', ' .join (revtags [0 :2 ]) if len (revtags ) else '' )) if repo .rev else ''
2168
2167
2169
- print "%s (%s)" % (prefix + (relpath (p_path , repo .path ) if p_path else repo .name ), ((repo .url + ('#' + str (repo .rev )[:12 ] if repo .rev else '' ) if detailed else revstr ) or 'no revision' ))
2168
+ print "%s (%s)" % (prefix + (relpath (p_path , repo .path ) if p_path else repo .name ), ((repo .url + ('#' + str (repo .rev )[:12 ] if repo .rev else '' ) if detailed else revstr ) or 'no revision' ))
2170
2169
2171
2170
for i , lib in enumerate (sorted (repo .libs , key = lambda l : l .path )):
2172
2171
nprefix = (prefix [:- 3 ] + ('| ' if prefix [- 3 ] == '|' else ' ' )) if prefix else ''
@@ -2189,26 +2188,26 @@ def releases_(detailed=False, unstable=False, recursive=False, prefix='', p_path
2189
2188
repo = Repo .fromrepo ()
2190
2189
tags = repo .scm .gettags ()
2191
2190
revtags = repo .scm .gettags (repo .rev ) if repo .rev else [] # associated tags with current commit
2192
- revstr = ('#' + repo .rev [:12 ]+ (', tags: ' + ', ' .join (revtags [0 :2 ]) if len (revtags ) else '' )) if repo .rev else ''
2191
+ revstr = ('#' + repo .rev [:12 ] + (', tags: ' + ', ' .join (revtags [0 :2 ]) if len (revtags ) else '' )) if repo .rev else ''
2193
2192
regex_rels = regex_rels_all if unstable else regex_rels_official
2194
2193
2195
2194
# Generate list of tags
2196
2195
rels = []
2197
2196
for tag in tags :
2198
2197
if re .match (regex_rels , tag [1 ]):
2199
- rels .append (tag [1 ] + " %s%s" % ('#' + tag [0 ] if detailed else "" , " <- current" if tag [1 ] in revtags else "" ))
2198
+ rels .append (tag [1 ] + " %s%s" % ('#' + tag [0 ] if detailed else "" , " <- current" if tag [1 ] in revtags else "" ))
2200
2199
2201
2200
# Print header
2202
- print "%s (%s)" % (prefix + (relpath (p_path , repo .path ) if p_path else repo .name ), ((repo .url + ('#' + str (repo .rev )[:12 ] if repo .rev else '' ) if detailed else revstr ) or 'no revision' ))
2201
+ print "%s (%s)" % (prefix + (relpath (p_path , repo .path ) if p_path else repo .name ), ((repo .url + ('#' + str (repo .rev )[:12 ] if repo .rev else '' ) if detailed else revstr ) or 'no revision' ))
2203
2202
2204
2203
# Print list of tags
2205
2204
rprefix = (prefix [:- 3 ] + ('| ' if prefix [- 3 ] == '|' else ' ' )) if recursive and prefix else ''
2206
2205
rprefix += '| ' if recursive and len (repo .libs ) > 1 else ' '
2207
2206
if len (rels ):
2208
2207
for rel in rels :
2209
- print rprefix + '* ' + rel
2208
+ print rprefix + '* ' + rel
2210
2209
else :
2211
- print rprefix + 'No release tags detected'
2210
+ print rprefix + 'No release tags detected'
2212
2211
2213
2212
if recursive :
2214
2213
for i , lib in enumerate (sorted (repo .libs , key = lambda l : l .path )):
0 commit comments