annotate tests/test-rebase-dest.t @ 33377:5d63e5f40bea

revset: define successors revset This revset returns all successors, including transit nodes and the source nodes (to be consistent with existing revsets like "ancestors"). To filter out transit nodes, use `successors(X)-obsolete()`. To filter out divergent case, use `successors(X)-divergent()-obsolete()`. The revset could be useful to define rebase destination, like: `max(successors(BASE)-divergent()-obsolete())`. The `max` is to deal with splits. There are other implementations where `successors` returns just one level of successors, and `allsuccessors` returns everything. I think `successors` returning all successors by default is more user friendly. We have seen cases in production where people use 1-level `successors` while they really want `allsuccessors`. So it seems better to just have one single revset returning all successors by default to avoid user errors. In the future we might want to add `depth` keyword argument to it and for other revsets like `ancestors` etc. Or even build some flexible indexing syntax [1] to satisfy people having the depth limit requirement. [1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-July/101140.html
author Jun Wu <quark@fb.com>
date Mon, 10 Jul 2017 10:56:40 -0700
parents 3b7cb3d17137
children 5e83a8fe6bc4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31729
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
1 Require a destination
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
2 $ cat >> $HGRCPATH <<EOF
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
3 > [extensions]
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
4 > rebase =
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
5 > [commands]
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
6 > rebase.requiredest = True
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
7 > EOF
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
8 $ hg init repo
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
9 $ cd repo
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
10 $ echo a >> a
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
11 $ hg commit -qAm aa
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
12 $ echo b >> b
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
13 $ hg commit -qAm bb
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
14 $ hg up ".^"
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
15 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
16 $ echo c >> c
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
17 $ hg commit -qAm cc
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
18 $ hg rebase
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
19 abort: you must specify a destination
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
20 (use: hg rebase -d REV)
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
21 [255]
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
22 $ hg rebase -d 1
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
23 rebasing 2:5db65b93a12b "cc" (tip)
33332
3b7cb3d17137 rebase: use scmutil.cleanupnodes (issue5606) (BC)
Jun Wu <quark@fb.com>
parents: 31733
diff changeset
24 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/5db65b93a12b-4fb789ec-rebase.hg (glob)
31729
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
25 $ hg rebase -d 0 -r . -q
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
26 $ HGPLAIN=1 hg rebase
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
27 rebasing 2:889b0bc6a730 "cc" (tip)
33332
3b7cb3d17137 rebase: use scmutil.cleanupnodes (issue5606) (BC)
Jun Wu <quark@fb.com>
parents: 31733
diff changeset
28 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/889b0bc6a730-41ec4f81-rebase.hg (glob)
31729
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
29 $ hg rebase -d 0 -r . -q
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
30 $ hg --config commands.rebase.requiredest=False rebase
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
31 rebasing 2:279de9495438 "cc" (tip)
33332
3b7cb3d17137 rebase: use scmutil.cleanupnodes (issue5606) (BC)
Jun Wu <quark@fb.com>
parents: 31733
diff changeset
32 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/279de9495438-ab0a5128-rebase.hg (glob)
31729
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
33
31730
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
34 Requiring dest should not break continue or other rebase options
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
35 $ hg up 1 -q
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
36 $ echo d >> c
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
37 $ hg commit -qAm dc
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
38 $ hg log -G -T '{rev} {desc}'
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
39 @ 3 dc
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
40 |
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
41 | o 2 cc
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
42 |/
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
43 o 1 bb
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
44 |
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
45 o 0 aa
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
46
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
47 $ hg rebase -d 2
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
48 rebasing 3:0537f6b50def "dc" (tip)
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
49 merging c
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
50 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
51 unresolved conflicts (see hg resolve, then hg rebase --continue)
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
52 [1]
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
53 $ echo d > c
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
54 $ hg resolve --mark --all
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
55 (no more unresolved files)
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
56 continue: hg rebase --continue
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
57 $ hg rebase --continue
31731
b5afec71c1f9 rebase: allow destination-free continue and abort (issue5513)
Ryan McElroy <rmcelroy@fb.com>
parents: 31730
diff changeset
58 rebasing 3:0537f6b50def "dc" (tip)
33332
3b7cb3d17137 rebase: use scmutil.cleanupnodes (issue5606) (BC)
Jun Wu <quark@fb.com>
parents: 31733
diff changeset
59 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/0537f6b50def-be4c7386-rebase.hg (glob)
31732
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
60
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
61 $ cd ..
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
62
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
63 Check rebase.requiredest interaction with pull --rebase
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
64 $ hg clone repo clone
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
65 updating to branch default
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
66 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
67 $ cd repo
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
68 $ echo e > e
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
69 $ hg commit -qAm ee
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
70 $ cd ..
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
71 $ cd clone
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
72 $ echo f > f
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
73 $ hg commit -qAm ff
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
74 $ hg pull --rebase
31733
ae6bab095c66 rebase: abort hg pull --rebase if rebase.requiredest is set (issue5514)
Ryan McElroy <rmcelroy@fb.com>
parents: 31732
diff changeset
75 abort: rebase destination required by configuration
ae6bab095c66 rebase: abort hg pull --rebase if rebase.requiredest is set (issue5514)
Ryan McElroy <rmcelroy@fb.com>
parents: 31732
diff changeset
76 (use hg pull followed by hg rebase -d DEST)
31732
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
77 [255]
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
78