Mercurial > hg
comparison tests/test-rebase-scenario-global.t @ 28022:e397b58c0563
rebase: respect checkunknown and checkignored in more cases
checkunknown and checkignored are currently respected for updates and regular
merges, but not for certain kinds of rebases. To be precise, they aren't
respected for rebases when:
(1) we're rebasing while currently on the destination commit, and
(2) an untracked or ignored file F is currently in the working copy, and
(3) the same file F is in a source commit, and
(4) F has different contents in the source commit.
This happens because rebases set force to True when calling merge.update.
Setting force to True makes a lot of sense in general, but it turns out the
force option is overloaded: there's a deprecated '--force' option in merge that
allows you to merge in outstanding changes, including changes in untracked
files. We use the 'mergeforce' parameter to tell those two cases apart.
I think the behavior during rebases when checkunknown is 'abort' (the default)
is wrong -- we should abort on or overwrite differing untracked files, not try
to merge them in. However that currently breaks rebases by aborting in the
middle -- we need better handling for that case before we can change the
default.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 03 Feb 2016 13:12:06 -0800 |
parents | 8bed1eae99df |
children | ecfa82447162 |
comparison
equal
deleted
inserted
replaced
28021:d0d805df6a44 | 28022:e397b58c0563 |
---|---|
23 $ cd .. | 23 $ cd .. |
24 | 24 |
25 | 25 |
26 Rebasing | 26 Rebasing |
27 D onto H - simple rebase: | 27 D onto H - simple rebase: |
28 (this also tests that editor is invoked if '--edit' is specified) | 28 (this also tests that editor is invoked if '--edit' is specified, and that we |
29 can abort or warn for colliding untracked files) | |
29 | 30 |
30 $ hg clone -q -u . a a1 | 31 $ hg clone -q -u . a a1 |
31 $ cd a1 | 32 $ cd a1 |
32 | 33 |
33 $ hg tglog | 34 $ hg tglog |
48 o 0: 'A' | 49 o 0: 'A' |
49 | 50 |
50 | 51 |
51 $ hg status --rev "3^1" --rev 3 | 52 $ hg status --rev "3^1" --rev 3 |
52 A D | 53 A D |
53 $ HGEDITOR=cat hg rebase -s 3 -d 7 --edit | 54 $ echo collide > D |
55 $ HGEDITOR=cat hg rebase -s 3 -d 7 --edit --config merge.checkunknown=warn | |
54 rebasing 3:32af7686d403 "D" | 56 rebasing 3:32af7686d403 "D" |
57 D: replacing untracked file | |
55 D | 58 D |
56 | 59 |
57 | 60 |
58 HG: Enter commit message. Lines beginning with 'HG:' are removed. | 61 HG: Enter commit message. Lines beginning with 'HG:' are removed. |
59 HG: Leave message empty to abort commit. | 62 HG: Leave message empty to abort commit. |
60 HG: -- | 63 HG: -- |
61 HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com> | 64 HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com> |
62 HG: branch 'default' | 65 HG: branch 'default' |
63 HG: added D | 66 HG: added D |
64 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob) | 67 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob) |
68 $ cat D.orig | |
69 collide | |
70 $ rm D.orig | |
65 | 71 |
66 $ hg tglog | 72 $ hg tglog |
67 o 7: 'D' | 73 o 7: 'D' |
68 | | 74 | |
69 @ 6: 'H' | 75 @ 6: 'H' |
82 | 88 |
83 $ cd .. | 89 $ cd .. |
84 | 90 |
85 | 91 |
86 D onto F - intermediate point: | 92 D onto F - intermediate point: |
87 (this also tests that editor is not invoked if '--edit' is not specified) | 93 (this also tests that editor is not invoked if '--edit' is not specified, and |
94 that we can ignore for colliding untracked files) | |
88 | 95 |
89 $ hg clone -q -u . a a2 | 96 $ hg clone -q -u . a a2 |
90 $ cd a2 | 97 $ cd a2 |
91 | 98 $ echo collide > D |
92 $ HGEDITOR=cat hg rebase -s 3 -d 5 | 99 |
100 $ HGEDITOR=cat hg rebase -s 3 -d 5 --config merge.checkunknown=ignore | |
93 rebasing 3:32af7686d403 "D" | 101 rebasing 3:32af7686d403 "D" |
94 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob) | 102 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob) |
103 $ cat D.orig | |
104 collide | |
105 $ rm D.orig | |
95 | 106 |
96 $ hg tglog | 107 $ hg tglog |
97 o 7: 'D' | 108 o 7: 'D' |
98 | | 109 | |
99 | @ 6: 'H' | 110 | @ 6: 'H' |
112 | 123 |
113 $ cd .. | 124 $ cd .. |
114 | 125 |
115 | 126 |
116 E onto H - skip of G: | 127 E onto H - skip of G: |
128 (this also tests that we can overwrite untracked files and don't create backups | |
129 if they have the same contents) | |
117 | 130 |
118 $ hg clone -q -u . a a3 | 131 $ hg clone -q -u . a a3 |
119 $ cd a3 | 132 $ cd a3 |
133 $ hg cat -r 4 E | tee E | |
134 E | |
120 | 135 |
121 $ hg rebase -s 4 -d 7 | 136 $ hg rebase -s 4 -d 7 |
122 rebasing 4:9520eea781bc "E" | 137 rebasing 4:9520eea781bc "E" |
123 rebasing 6:eea13746799a "G" | 138 rebasing 6:eea13746799a "G" |
124 note: rebase of 6:eea13746799a created no changes to commit | 139 note: rebase of 6:eea13746799a created no changes to commit |
125 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-backup.hg (glob) | 140 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-backup.hg (glob) |
141 $ f E.orig | |
142 E.orig: file not found | |
126 | 143 |
127 $ hg tglog | 144 $ hg tglog |
128 o 6: 'E' | 145 o 6: 'E' |
129 | | 146 | |
130 @ 5: 'H' | 147 @ 5: 'H' |