##// END OF EJS Templates
Improvements for hg identify:...
Thomas Arendsen Hein -
r386:494c8e3f default
parent child Browse files
Show More
@@ -333,21 +333,24 b' def history(ui, repo):'
333
333
334 def identify(ui, repo):
334 def identify(ui, repo):
335 """print information about the working copy"""
335 """print information about the working copy"""
336 (c, a, d, u) = repo.diffdir(repo.root)
337 mflag = (c or a or d or u) and "+" or ""
338 parents = [p for p in repo.dirstate.parents() if p != hg.nullid]
336 parents = [p for p in repo.dirstate.parents() if p != hg.nullid]
339 if not parents:
337 if not parents:
340 ui.write("unknown\n")
338 ui.write("unknown\n")
341 return
339 return
342
340
343 tstring = ''
341 hexfunc = ui.verbose and hg.hex or hg.short
342 (c, a, d, u) = repo.diffdir(repo.root)
343 output = ["%s%s" % ('+'.join([hexfunc(parent) for parent in parents]),
344 (c or a or d) and "+" or "")]
345
344 if not ui.quiet:
346 if not ui.quiet:
345 tags = sum(map(repo.nodetags, parents), [])
347 # multiple tags for a single parent separated by '/'
346 tstring = " " + ' + '.join(tags)
348 parenttags = ['/'.join(tags)
349 for tags in map(repo.nodetags, parents) if tags]
350 # tags for multiple parents separated by ' + '
351 output.append(' + '.join(parenttags))
347
352
348 hexfunc = ui.verbose and hg.hex or hg.short
353 ui.write("%s\n" % ' '.join(output))
349 pstring = '+'.join([hexfunc(parent) for parent in parents])
350 ui.write("%s%s%s\n" % (pstring, mflag, tstring))
351
354
352 def init(ui, source=None):
355 def init(ui, source=None):
353 """create a new repository or copy an existing one"""
356 """create a new repository or copy an existing one"""
General Comments 0
You need to be logged in to leave comments. Login now