diff options
| author | Mike Frysinger <vapier@google.com> | 2019-10-01 01:17:55 -0400 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2019-10-05 05:24:34 +0000 |
| commit | f1c5dd8a0fdfa6ef916ea1befea9c44a10eae73f (patch) | |
| tree | 21906ee8c28f9e641f7a5a6e9f40ef31d2f945ac | |
| parent | 2058c6364180a899bc17b8cefba193f931ef4493 (diff) | |
| download | git-repo-f1c5dd8a0fdfa6ef916ea1befea9c44a10eae73f.tar.gz | |
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 <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
| -rw-r--r-- | subcmds/info.py | 10 |
1 files 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): | |||
| 94 | self.out.nl() | 94 | self.out.nl() |
| 95 | 95 | ||
| 96 | self.heading("Current revision: ") | 96 | self.heading("Current revision: ") |
| 97 | self.headtext(p.revisionExpr) | 97 | self.headtext(p.GetRevisionId()) |
| 98 | self.out.nl() | 98 | self.out.nl() |
| 99 | 99 | ||
| 100 | currentBranch = p.CurrentBranch | ||
| 101 | if currentBranch: | ||
| 102 | self.heading('Current branch: ') | ||
| 103 | self.headtext(currentBranch) | ||
| 104 | self.out.nl() | ||
| 105 | |||
| 100 | localBranches = list(p.GetBranches().keys()) | 106 | localBranches = list(p.GetBranches().keys()) |
| 101 | self.heading("Local Branches: ") | 107 | self.heading("Local Branches: ") |
| 102 | self.redtext(str(len(localBranches))) | 108 | self.redtext(str(len(localBranches))) |
| 103 | if len(localBranches) > 0: | 109 | if localBranches: |
| 104 | self.text(" [") | 110 | self.text(" [") |
| 105 | self.text(", ".join(localBranches)) | 111 | self.text(", ".join(localBranches)) |
| 106 | self.text("]") | 112 | self.text("]") |
