From f1c5dd8a0fdfa6ef916ea1befea9c44a10eae73f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 1 Oct 2019 01:17:55 -0400 Subject: [PATCH] info: fix "current" output The "Current revision" field shows the revision as listed in the manifest. I think most users expect this to show the revision that the git tree is checked out to instead. Switch the output to show that revision instead, and add a "Current branch" if it matches a local branch. Change-Id: Ib546f5ebbc8a23875fbd14bf166fbe95b7dd244e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239240 Reviewed-by: David Pursehouse Tested-by: Mike Frysinger --- subcmds/info.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/subcmds/info.py b/subcmds/info.py index 0d5696dd..b1e92e3e 100644 --- a/subcmds/info.py +++ b/subcmds/info.py @@ -94,13 +94,19 @@ class Info(PagedCommand): self.out.nl() self.heading("Current revision: ") - self.headtext(p.revisionExpr) + self.headtext(p.GetRevisionId()) self.out.nl() + currentBranch = p.CurrentBranch + if currentBranch: + self.heading('Current branch: ') + self.headtext(currentBranch) + self.out.nl() + localBranches = list(p.GetBranches().keys()) self.heading("Local Branches: ") self.redtext(str(len(localBranches))) - if len(localBranches) > 0: + if localBranches: self.text(" [") self.text(", ".join(localBranches)) self.text("]")