@@ -1025,14 +1025,16 @@ def pathtype(cls, path=None):
1025
1025
1026
1026
return "directory" if depth == 0 else ("program" if depth == 1 else "library" )
1027
1027
1028
- def revtype (self , rev = None , ret_type = True , ret_rev = True ):
1028
+ def revtype (self , rev = None , ret_type = True , ret_rev = True , fmt = 3 ):
1029
1029
if rev is None or len (rev ) == 0 :
1030
- return ('latest' if ret_type else '' ) + (' revision in the current branch' if ret_rev else '' )
1030
+ output = ('latest' if fmt & 1 else '' ) + (' revision in the current branch' if fmt & 2 else '' )
1031
1031
elif re .match (r'^([a-fA-F0-9]{6,40})$' , rev ) or re .match (r'^([0-9]+)$' , rev ):
1032
1032
revtags = self .scm .gettags (rev ) if self .scm and rev else []
1033
- return ('rev ' if ret_type else '' ) + (('#' + rev [:12 ] + ((' (tag' + ('s' if len (revtags ) > 1 else '' ) + ': ' + ', ' .join (revtags [0 :2 ]) + ')' ) if len (revtags ) else '' )) if ret_rev and rev else '' )
1033
+ output = ('rev ' if fmt & 1 else '' ) + (('#' + rev [:12 ] + ((' (tag' + ('s' if len (revtags ) > 1 else '' ) + ': ' + ', ' .join (revtags [0 :2 ]) + ')' ) if len (revtags ) else '' )) if fmt & 2 and rev else '' )
1034
1034
else :
1035
- return ('branch/tag' if ret_type else '' ) + (' "' + rev + '"' if ret_rev else '' )
1035
+ output = ('branch/tag' if fmt & 1 else '' ) + (' "' + rev + '"' if fmt & 2 else '' )
1036
+
1037
+ return re .sub (r' \(' , ', ' , re .sub (r'\)' , '' , output )) if fmt & 4 else output
1036
1038
1037
1039
@classmethod
1038
1040
def isurl (cls , url ):
@@ -2178,7 +2180,7 @@ def sync(recursive=True, keep_refs=False, top=True):
2178
2180
def list_ (detailed = False , prefix = '' , p_path = None , ignore = False ):
2179
2181
repo = Repo .fromrepo ()
2180
2182
2181
- 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 re . sub ( r' \(' , ', ' , re . sub ( r'\)' , '' , repo .revtype (repo .rev , False )) )) or 'no revision' ))
2183
+ 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 repo .revtype (repo .rev , fmt = 6 )) or 'no revision' ))
2182
2184
2183
2185
for i , lib in enumerate (sorted (repo .libs , key = lambda l : l .path )):
2184
2186
nprefix = (prefix [:- 3 ] + ('| ' if prefix [- 3 ] == '|' else ' ' )) if prefix else ''
@@ -2210,7 +2212,7 @@ def releases_(detailed=False, unstable=False, recursive=False, prefix='', p_path
2210
2212
rels .append (tag [1 ] + " %s%s" % ('#' + tag [0 ] if detailed else "" , " <- current" if tag [1 ] in revtags else "" ))
2211
2213
2212
2214
# Print header
2213
- 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 re . sub ( r' \(' , ', ' , re . sub ( r'\)' , '' , repo .revtype (repo .rev , False )) )) or 'no revision' ))
2215
+ 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 repo .revtype (repo .rev , fmt = 6 )) or 'no revision' ))
2214
2216
2215
2217
# Print list of tags
2216
2218
rprefix = (prefix [:- 3 ] + ('| ' if prefix [- 3 ] == '|' else ' ' )) if recursive and prefix else ''
0 commit comments