##// END OF EJS Templates
identify: use contexts
Matt Mackall -
r4664:dedb8abf default
parent child Browse files
Show More
@@ -1442,28 +1442,24 b' def identify(ui, repo):'
1442 in the working directory, followed by a list of tags for this revision.
1442 in the working directory, followed by a list of tags for this revision.
1443 """
1443 """
1444
1444
1445 parents = [p for p in repo.dirstate.parents() if p != nullid]
1446 if not parents:
1447 parents = [nullid]
1448
1449 hexfunc = ui.debugflag and hex or short
1445 hexfunc = ui.debugflag and hex or short
1450 modified, added, removed, deleted = repo.status()[:4]
1446
1451 output = ["%s%s" %
1447 wctx = repo.workingctx()
1452 ('+'.join([hexfunc(parent) for parent in parents]),
1448 parents = wctx.parents()
1453 (modified or added or removed or deleted) and "+" or "")]
1449 changed = wctx.files() + wctx.deleted()
1450
1451 output = ["%s%s" % ('+'.join([hexfunc(p.node()) for p in parents]),
1452 (changed) and "+" or "")]
1454
1453
1455 if not ui.quiet:
1454 if not ui.quiet:
1456
1455 branch = util.tolocal(wctx.branch())
1457 branch = util.tolocal(repo.workingctx().branch())
1458 if branch != 'default':
1456 if branch != 'default':
1459 output.append("(%s)" % branch)
1457 output.append("(%s)" % branch)
1460
1458
1461 # multiple tags for a single parent separated by '/'
1459 # multiple tags for a single parent separated by '/'
1462 parenttags = ['/'.join(tags)
1460 tags = "/".join(wctx.tags())
1463 for tags in map(repo.nodetags, parents) if tags]
1461 if tags:
1464 # tags for multiple parents separated by ' + '
1462 output.append(tags)
1465 if parenttags:
1466 output.append(' + '.join(parenttags))
1467
1463
1468 ui.write("%s\n" % ' '.join(output))
1464 ui.write("%s\n" % ' '.join(output))
1469
1465
General Comments 0
You need to be logged in to leave comments. Login now