Mercurial > hg
annotate tests/test-revisions.t @ 44574:5205b46bd887
fix: add a -s option to format a revision and its descendants
`hg fix -r abc123` will format that commit but not its
descendants. That seems expected given the option name (`-r`), but
it's very rarely what the user wants to do. The problem is that any
descendants of that commit will not be formatted, leaving them as
orphans that are hard to evolve. They are hard to evolve because the
new parent will have formatting changes that the orphan doesn't have.
I talked to Danny Hooper (who wrote most of the fix extension) about
the problem and we agreed that deprecating `-r` in favor of a new `-s`
argument (mimicing rebase's `-s`) would be a good way of reducing the
risk that users end up with these hard-to-evolve orphans. So that's
what this patch implements.
Differential Revision: https://phab.mercurial-scm.org/D8287
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 13 Mar 2020 12:16:00 -0700 |
parents | d916ed3ca951 |
children | 95c4cca641f6 |
rev | line source |
---|---|
38842
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
1 $ hg init repo |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
2 $ cd repo |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
3 |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
4 $ echo 0 > a |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
5 $ hg ci -qAm 0 |
39069
4c4825db29e1
shortest: don't include nullid in disambigution revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
38843
diff
changeset
|
6 $ for i in 5 8 14 43 167; do |
38842
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
7 > hg up -q 0 |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
8 > echo $i > a |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
9 > hg ci -qm $i |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
10 > done |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
11 $ cat <<EOF >> .hg/hgrc |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
12 > [alias] |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
13 > l = log -T '{rev}:{shortest(node,1)}\n' |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
14 > EOF |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
15 |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
16 $ hg l |
39069
4c4825db29e1
shortest: don't include nullid in disambigution revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
38843
diff
changeset
|
17 5:00f |
38842
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
18 4:7ba5d |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
19 3:7ba57 |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
20 2:72 |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
21 1:9 |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
22 0:b |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
23 $ cat <<EOF >> .hg/hgrc |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
24 > [experimental] |
39069
4c4825db29e1
shortest: don't include nullid in disambigution revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
38843
diff
changeset
|
25 > revisions.disambiguatewithin=not 4 |
38842
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
26 > EOF |
38843
6f7c9527030b
scmutil: make shortest() respect disambiguation revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
38842
diff
changeset
|
27 $ hg l |
40341
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
39069
diff
changeset
|
28 5:00 |
38843
6f7c9527030b
scmutil: make shortest() respect disambiguation revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
38842
diff
changeset
|
29 4:7ba5d |
6f7c9527030b
scmutil: make shortest() respect disambiguation revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
38842
diff
changeset
|
30 3:7b |
6f7c9527030b
scmutil: make shortest() respect disambiguation revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
38842
diff
changeset
|
31 2:72 |
6f7c9527030b
scmutil: make shortest() respect disambiguation revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
38842
diff
changeset
|
32 1:9 |
6f7c9527030b
scmutil: make shortest() respect disambiguation revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
38842
diff
changeset
|
33 0:b |
38842
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
34 9 was unambiguous and still is |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
35 $ hg l -r 9 |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
36 1:9 |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
37 7 was ambiguous and still is |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
38 $ hg l -r 7 |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
39 abort: 00changelog.i@7: ambiguous identifier! |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
40 [255] |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
41 7b is no longer ambiguous |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
42 $ hg l -r 7b |
38843
6f7c9527030b
scmutil: make shortest() respect disambiguation revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
38842
diff
changeset
|
43 3:7b |
38842
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
44 |
503f936489dd
lookup: add option to disambiguate prefix within revset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
45 $ cd .. |