Mercurial > evolve
changeset 4393:159a4a6ded0b
prompts: use 1-indexing in revselectionprompt()
The consumer is generally a human, not a computer. I've made the
mistake of entering "1" instead of "0" a few times myself.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 30 Jan 2019 10:03:00 -0800 |
parents | c09889f81947 |
children | c6d1b0a6babe |
files | hgext3rd/evolve/utility.py tests/test-evolve-issue5832.t tests/test-evolve-orphan-split.t tests/test-prev-next.t |
diffstat | 4 files changed, 49 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/utility.py Thu Feb 07 16:24:59 2019 +0800 +++ b/hgext3rd/evolve/utility.py Wed Jan 30 10:03:00 2019 -0800 @@ -164,7 +164,7 @@ promptmsg = customheader + "\n" for idx, rev in enumerate(revs): curctx = repo[rev] - revmsg = "%d: [%s] %s\n" % (idx, curctx, + revmsg = "%d: [%s] %s\n" % (idx + 1, curctx, curctx.description().split("\n")[0]) promptmsg += revmsg @@ -181,9 +181,9 @@ ui.write_err(_("invalid value '%s' entered for index\n") % idxselected) return None - if intidx >= len(revs) or intidx < 0: + if intidx > len(revs) or intidx <= 0: # we can make this error message better ui.write_err(_("invalid value '%d' entered for index\n") % intidx) return None - return revs[intidx] + return revs[intidx - 1]
--- a/tests/test-evolve-issue5832.t Thu Feb 07 16:24:59 2019 +0800 +++ b/tests/test-evolve-issue5832.t Wed Jan 30 10:03:00 2019 -0800 @@ -112,17 +112,17 @@ Resolving instability using `hg evolve` $ hg evolve --any --all --config ui.interactive=True <<EOF - > 0 + > 1 > EOF move:[2] added b atop:[5] added a move:[4] merge commit ancestor '7235ef625ea3' split over multiple topological branches. choose an evolve destination: - 0: [62fb70414f99] added c - 1: [5841d7cf9893] added d + 1: [62fb70414f99] added c + 2: [5841d7cf9893] added d q: quit the prompt - enter the index of the revision you want to select: 0 + enter the index of the revision you want to select: 1 move:[9] merge commit atop:[6] added c working directory is now at 28a0775ac832 @@ -253,17 +253,17 @@ could not solve instability, ambiguous destination: parent split across two branches $ hg evolve --any --all --config ui.interactive=True <<EOF - > 1 + > 2 > EOF move:[2] added b atop:[6] added a move:[4] merge commit ancestor 'cdf2ea1b9312' split over multiple topological branches. choose an evolve destination: - 0: [62fb70414f99] added c - 1: [5841d7cf9893] added d + 1: [62fb70414f99] added c + 2: [5841d7cf9893] added d q: quit the prompt - enter the index of the revision you want to select: 1 + enter the index of the revision you want to select: 2 move:[10] merge commit atop:[8] added d working directory is now at 460e6e72b7f9 @@ -398,16 +398,16 @@ could not solve instability, ambiguous destination: parent split across two branches $ hg evolve --any --all --config ui.interactive=True <<EOF - > 1 + > 2 > EOF move:[2] added b atop:[6] added a ancestor 'b9b387427a53' split over multiple topological branches. choose an evolve destination: - 0: [62fb70414f99] added c - 1: [5841d7cf9893] added d + 1: [62fb70414f99] added c + 2: [5841d7cf9893] added d q: quit the prompt - enter the index of the revision you want to select: 1 + enter the index of the revision you want to select: 2 move:[4] merge commit atop:[8] added d move:[10] merge commit
--- a/tests/test-evolve-orphan-split.t Thu Feb 07 16:24:59 2019 +0800 +++ b/tests/test-evolve-orphan-split.t Wed Jan 30 10:03:00 2019 -0800 @@ -182,27 +182,27 @@ () draft $ hg evolve --dry-run <<EOF - > 0 + > 1 > EOF ancestor 'd48a30875f01' split over multiple topological branches. choose an evolve destination: - 0: [f2632392aefe] added a b c - 1: [7f87764e5b64] added a b c + 1: [f2632392aefe] added a b c + 2: [7f87764e5b64] added a b c q: quit the prompt - enter the index of the revision you want to select: 0 + enter the index of the revision you want to select: 1 move:[7] added d atop:[8] added a b c hg rebase -r d48a30875f01 -d f2632392aefe $ hg evolve --dry-run <<EOF - > 1 + > 2 > EOF ancestor 'd48a30875f01' split over multiple topological branches. choose an evolve destination: - 0: [f2632392aefe] added a b c - 1: [7f87764e5b64] added a b c + 1: [f2632392aefe] added a b c + 2: [7f87764e5b64] added a b c q: quit the prompt - enter the index of the revision you want to select: 1 + enter the index of the revision you want to select: 2 move:[7] added d atop:[10] added a b c hg rebase -r d48a30875f01 -d 7f87764e5b64 @@ -215,8 +215,8 @@ > EOF ancestor 'd48a30875f01' split over multiple topological branches. choose an evolve destination: - 0: [f2632392aefe] added a b c - 1: [7f87764e5b64] added a b c + 1: [f2632392aefe] added a b c + 2: [7f87764e5b64] added a b c q: quit the prompt enter the index of the revision you want to select: foo invalid value 'foo' entered for index @@ -227,8 +227,8 @@ > EOF ancestor 'd48a30875f01' split over multiple topological branches. choose an evolve destination: - 0: [f2632392aefe] added a b c - 1: [7f87764e5b64] added a b c + 1: [f2632392aefe] added a b c + 2: [7f87764e5b64] added a b c q: quit the prompt enter the index of the revision you want to select: 4 invalid value '4' entered for index @@ -239,8 +239,8 @@ > EOF ancestor 'd48a30875f01' split over multiple topological branches. choose an evolve destination: - 0: [f2632392aefe] added a b c - 1: [7f87764e5b64] added a b c + 1: [f2632392aefe] added a b c + 2: [7f87764e5b64] added a b c q: quit the prompt enter the index of the revision you want to select: -1 invalid value '-1' entered for index @@ -251,8 +251,8 @@ > EOF ancestor 'd48a30875f01' split over multiple topological branches. choose an evolve destination: - 0: [f2632392aefe] added a b c - 1: [7f87764e5b64] added a b c + 1: [f2632392aefe] added a b c + 2: [7f87764e5b64] added a b c q: quit the prompt enter the index of the revision you want to select: q could not solve instability, ambiguous destination: parent split across two branches @@ -264,10 +264,10 @@ > EOF ancestor 'd48a30875f01' split over multiple topological branches. choose an evolve destination: - 0: [f2632392aefe] added a b c - 1: [7f87764e5b64] added a b c + 1: [f2632392aefe] added a b c + 2: [7f87764e5b64] added a b c q: quit the prompt enter the index of the revision you want to select: 1 move:[7] added d - atop:[10] added a b c - working directory is now at 1c6caa7c902a + atop:[8] added a b c + working directory is now at 71e4d45a7aaa
--- a/tests/test-prev-next.t Thu Feb 07 16:24:59 2019 +0800 +++ b/tests/test-prev-next.t Wed Jan 30 10:03:00 2019 -0800 @@ -213,13 +213,13 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved [3] added b (2) $ hg next <<EOF - > 1 + > 2 > EOF ambiguous next changeset, choose one to update: - 0: [e3b6d5df389b] added c - 1: [9df671ccd2c7] added d + 1: [e3b6d5df389b] added c + 2: [9df671ccd2c7] added d q: quit the prompt - enter the index of the revision you want to select: 1 + enter the index of the revision you want to select: 2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved [5] added d @@ -236,13 +236,13 @@ (2 unstable changesets to be evolved here, do you want --evolve?) [1] $ hg next --evolve <<EOF - > 0 + > 1 > EOF ambiguous next (unstable) changeset, choose one to evolve and update: - 0: [e3b6d5df389b] added c - 1: [9df671ccd2c7] added d + 1: [e3b6d5df389b] added c + 2: [9df671ccd2c7] added d q: quit the prompt - enter the index of the revision you want to select: 0 + enter the index of the revision you want to select: 1 move:[4] added c atop:[6] added b (3) working directory now at 5ce67c2407b0 @@ -284,8 +284,8 @@ > q > EOF multiple parents, choose one to update: - 0: [47ea25be8aea] added d - 1: [5ce67c2407b0] added c + 1: [47ea25be8aea] added d + 2: [5ce67c2407b0] added c q: quit the prompt enter the index of the revision you want to select: q [8] added d @@ -300,13 +300,13 @@ [1] $ hg prev <<EOF - > 1 + > 2 > EOF multiple parents, choose one to update: - 0: [47ea25be8aea] added d - 1: [5ce67c2407b0] added c + 1: [47ea25be8aea] added d + 2: [5ce67c2407b0] added c q: quit the prompt - enter the index of the revision you want to select: 1 + enter the index of the revision you want to select: 2 0 files updated, 0 files merged, 1 files removed, 0 files unresolved [7] added c