Mercurial > hg > mercurial-source
annotate tests/test-pathconflicts-basic.t @ 36490:41ef02ba329b
merge: add `--abort` flag which can abort the merge
Currently we don't have a good functionality to abort the merge and tell user to
do `hg update -C .` which can leads to different results if user missed the '.'
and moreover does not align with other abort functionalities like rebase, shelve
etc.
This patch adds `hg merge --abort` which will abort the ongoing merge and take
us back to the chagneset where we started from. Works in both cases when merge
resulted in conflicts and when there were no conflicts.
.. feature::
A `--abort` flag to merge command to abort the ongoing merge.
Differential Revision: https://phab.mercurial-scm.org/D1829
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 08 Jan 2018 19:41:47 +0530 (2018-01-08) |
parents | 2a774cae3a03 |
children | 0b46e1aa7760 |
rev | line source |
---|---|
35725
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
35339
diff
changeset
|
1 Path conflict checking is currently disabled by default because of issue5716. |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
35339
diff
changeset
|
2 Turn it on for this test. |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
35339
diff
changeset
|
3 |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
35339
diff
changeset
|
4 $ cat >> $HGRCPATH << EOF |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
35339
diff
changeset
|
5 > [experimental] |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
35339
diff
changeset
|
6 > merge.checkpathconflicts=True |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
35339
diff
changeset
|
7 > EOF |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
35339
diff
changeset
|
8 |
35327
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
9 $ hg init repo |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
10 $ cd repo |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
11 $ echo base > base |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
12 $ hg add base |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
13 $ hg commit -m "base" |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
14 $ hg bookmark -i base |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
15 $ echo 1 > a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
16 $ hg add a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
17 $ hg commit -m "file" |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
18 $ hg bookmark -i file |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
19 $ echo 2 > a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
20 $ hg commit -m "file2" |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
21 $ hg bookmark -i file2 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
22 $ hg up -q 0 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
23 $ mkdir a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
24 $ echo 2 > a/b |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
25 $ hg add a/b |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
26 $ hg commit -m "dir" |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
27 created new head |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
28 $ hg bookmark -i dir |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
29 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
30 Basic merge - local file conflicts with remote directory |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
31 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
32 $ hg up -q file |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
33 $ hg bookmark -i |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
34 $ hg merge --verbose dir |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
35 resolving manifests |
35338
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
35336
diff
changeset
|
36 a: path conflict - a file or link has the same name as a directory |
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
35336
diff
changeset
|
37 the local file has been renamed to a~853701544ac3 |
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
35336
diff
changeset
|
38 resolve manually then use 'hg resolve --mark a' |
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
35336
diff
changeset
|
39 moving a to a~853701544ac3 |
35327
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
40 getting a/b |
35338
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
35336
diff
changeset
|
41 1 files updated, 0 files merged, 0 files removed, 1 files unresolved |
36490
41ef02ba329b
merge: add `--abort` flag which can abort the merge
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35725
diff
changeset
|
42 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
35338
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
35336
diff
changeset
|
43 [1] |
35327
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
44 $ hg update --clean . |
35338
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
35336
diff
changeset
|
45 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
35339
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
46 $ rm a~853701544ac3 |
35327
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
47 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
48 Basic update - local directory conflicts with remote file |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
49 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
50 $ hg up -q 0 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
51 $ mkdir a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
52 $ echo 3 > a/b |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
53 $ hg up file |
35336
0217d66846f7
merge: improve error messages for path conflicts during update
Mark Thomas <mbthomas@fb.com>
parents:
35335
diff
changeset
|
54 a: untracked directory conflicts with file |
35335
33c8a6837181
merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
35327
diff
changeset
|
55 abort: untracked files in working directory differ from files in requested revision |
35327
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
56 [255] |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
57 $ hg up --clean file |
35339
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
58 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
59 (activating bookmark file) |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
60 |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
61 Repo state is ok |
35327
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
62 |
35339
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
63 $ hg sum |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
64 parent: 1:853701544ac3 |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
65 file |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
66 branch: default |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
67 bookmarks: *file |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
68 commit: (clean) |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
69 update: 2 new changesets (update) |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
70 phases: 4 draft |
35327
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
71 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
72 Basic update - untracked file conflicts with remote directory |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
73 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
74 $ hg up -q 0 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
75 $ echo untracked > a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
76 $ hg up --config merge.checkunknown=warn dir |
35335
33c8a6837181
merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
35327
diff
changeset
|
77 a: replacing untracked file |
33c8a6837181
merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
35327
diff
changeset
|
78 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
33c8a6837181
merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
35327
diff
changeset
|
79 (activating bookmark dir) |
35339
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
80 $ cat a.orig |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
81 untracked |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
82 $ rm -f a.orig |
35327
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
83 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
84 Basic clean update - local directory conflicts with changed remote file |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
85 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
86 $ hg up -q file |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
87 $ rm a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
88 $ mkdir a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
89 $ echo 4 > a/b |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
90 $ hg up file2 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
91 abort: *: '$TESTTMP/repo/a' (glob) |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
92 [255] |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
93 $ hg up --clean file2 |
35339
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
95 (activating bookmark file2) |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
96 |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
97 Repo state is ok |
35327
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
98 |
35339
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
99 $ hg sum |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
100 parent: 2:f64e09fac717 |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
101 file2 |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
102 branch: default |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
103 bookmarks: *file2 |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
104 commit: (clean) |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
105 update: 1 new changesets, 2 branch heads (merge) |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
35338
diff
changeset
|
106 phases: 4 draft |