annotate tests/test-rename-dir-merge.t @ 24545:9e0c67e84896

json: implement {tags} template Tags is pretty easy to implement. Let's start there. The output is slightly different from `hg tags -Tjson`. For reference, the CLI has the following output: [ { "node": "e2049974f9a23176c2addb61d8f5b86e0d620490", "rev": 29880, "tag": "tip", "type": "" }, ... ] Our output has the format: { "node": "0aeb19ea57a6d223bacddda3871cb78f24b06510", "tags": [ { "node": "e2049974f9a23176c2addb61d8f5b86e0d620490", "tag": "tag1", "date": [1427775457.0, 25200] }, ... ] } "rev" is omitted because it isn't a reliable identifier. We shouldn't be exposing them in web APIs and giving the impression it remotely resembles a stable identifier. Perhaps we could one day hide this behind a config option (it might be useful to expose when running servers locally). The "type" of the tag isn't defined because this information isn't yet exposed to the hgweb templater (it could be in a follow-up) and because it is questionable whether different types should be exposed at all. (Should the web interface really be exposing "local" tags?) We use an object for the outer type instead of Array for a few reasons. First, it is extensible. If we ever need to throw more global properties into the output, we can do that without breaking backwards compatibility (property additions should be backwards compatible). Second, uniformity in web APIs is nice. Having everything return objects seems much saner than a mix of array and object. Third, there are security issues with arrays in older browsers. The JSON web services world almost never uses arrays as the main type for this reason. Another possibly controversial part about this patch is how dates are defined. While JSON has a Date type, it is based on the JavaScript Date type, which is widely considered a pile of garbage. It is a non-starter for this reason. Many of Mercurial's built-in date filters drop seconds resolution. So that's a non-starter as well, since we want the API to be lossless where possible. rfc3339date, rfc822date, isodatesec, and date are all lossless. However, they each require the client to perform string parsing on top of JSON decoding. While date parsing libraries are pretty ubiquitous, some languages don't have them out of the box. However, pretty much every programming language can deal with UNIX timestamps (which are just integers or floats). So, we choose to use Mercurial's internal date representation, which in JSON is modeled as float seconds since UNIX epoch and an integer timezone offset from UTC (keep in mind JavaScript/JSON models all "Numbers" as double prevision floating point numbers, so there isn't a difference between ints and floats in JSON).
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 31 Mar 2015 14:52:21 -0700
parents 0297d8469350
children bd625cd4e5e7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13956
ffb5c09ba822 tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents: 12114
diff changeset
1 $ hg init t
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
2 $ cd t
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
3
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
4 $ mkdir a
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
5 $ echo foo > a/a
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
6 $ echo bar > a/b
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
7 $ hg ci -Am "0"
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
8 adding a/a
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
9 adding a/b
3733
9e67fecbfd16 merge: handle directory renames
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
10
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
11 $ hg co -C 0
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
12 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
13 $ hg mv a b
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
14 moving a/a to b/a (glob)
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
15 moving a/b to b/b (glob)
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
16 $ hg ci -m "1 mv a/ b/"
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
17
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
18 $ hg co -C 0
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
19 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
20 $ echo baz > a/c
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
21 $ echo quux > a/d
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
22 $ hg add a/c
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
23 $ hg ci -m "2 add a/c"
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
24 created new head
3733
9e67fecbfd16 merge: handle directory renames
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
25
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
26 $ hg merge --debug 1
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
27 searching for copies back to rev 1
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
28 unmatched files in local:
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
29 a/c
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
30 unmatched files in other:
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
31 b/a
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
32 b/b
16795
e9ae770eff1c merge: show renamed on one and deleted on the other side in debug output
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16094
diff changeset
33 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
18135
a6fe1b9cc68f copies: make debug messages more sensible
Siddharth Agarwal <sid0@fb.com>
parents: 16913
diff changeset
34 src: 'a/a' -> dst: 'b/a'
a6fe1b9cc68f copies: make debug messages more sensible
Siddharth Agarwal <sid0@fb.com>
parents: 16913
diff changeset
35 src: 'a/b' -> dst: 'b/b'
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
36 checking for directory renames
18135
a6fe1b9cc68f copies: make debug messages more sensible
Siddharth Agarwal <sid0@fb.com>
parents: 16913
diff changeset
37 discovered dir src: 'a/' -> dst: 'b/'
a6fe1b9cc68f copies: make debug messages more sensible
Siddharth Agarwal <sid0@fb.com>
parents: 16913
diff changeset
38 pending file src: 'a/c' -> dst: 'b/c'
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
39 resolving manifests
18605
bcf29565d89f manifestmerge: pass in branchmerge and force separately
Siddharth Agarwal <sid0@fb.com>
parents: 18360
diff changeset
40 branchmerge: True, force: False, partial: False
15625
efdcce3fd2d5 merge: make debug output easier to read
Martin Geisler <mg@aragost.com>
parents: 15447
diff changeset
41 ancestor: f9b20c0d4c51, local: ce36d17b18fb+, remote: 397f8b00a740
18360
760c0d67ce5e merge: process files in sorted order
Mads Kiilerich <mads@kiilerich.com>
parents: 18135
diff changeset
42 a/a: other deleted -> r
21391
cb15835456cb merge: change debug logging - test output changes but no real changes
Mads Kiilerich <madski@unity3d.com>
parents: 20944
diff changeset
43 removing a/a
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
44 a/b: other deleted -> r
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
45 removing a/b
19095
5cc71484ee9c merge: increase safety of parallel updating/removing on icasefs
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18634
diff changeset
46 updating: a/b 2/5 files (40.00%)
21391
cb15835456cb merge: change debug logging - test output changes but no real changes
Mads Kiilerich <madski@unity3d.com>
parents: 20944
diff changeset
47 b/a: remote created -> g
18631
e2dc5397bc82 tests: update test output (will be folded into parent)
Bryan O'Sullivan <bryano@fb.com>
parents: 18605
diff changeset
48 getting b/a
21391
cb15835456cb merge: change debug logging - test output changes but no real changes
Mads Kiilerich <madski@unity3d.com>
parents: 20944
diff changeset
49 b/b: remote created -> g
18631
e2dc5397bc82 tests: update test output (will be folded into parent)
Bryan O'Sullivan <bryano@fb.com>
parents: 18605
diff changeset
50 getting b/b
e2dc5397bc82 tests: update test output (will be folded into parent)
Bryan O'Sullivan <bryano@fb.com>
parents: 18605
diff changeset
51 updating: b/b 4/5 files (80.00%)
21391
cb15835456cb merge: change debug logging - test output changes but no real changes
Mads Kiilerich <madski@unity3d.com>
parents: 20944
diff changeset
52 b/c: remote directory rename - move from a/c -> dm
20944
5b8d5803d7b7 merge: keep destination filename as key in actions for merge with dir rename
Mads Kiilerich <madski@unity3d.com>
parents: 19133
diff changeset
53 updating: b/c 5/5 files (100.00%)
19133
101b80eb7364 tests: check path separator in moves
Brendan Cully <brendan@kublai.com>
parents: 19095
diff changeset
54 moving a/c to b/c (glob)
16094
0776a6cababe merge: don't use unknown()
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
55 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
56 (branch merge, don't forget to commit)
3733
9e67fecbfd16 merge: handle directory renames
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
57
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
58 $ echo a/* b/*
16094
0776a6cababe merge: don't use unknown()
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
59 a/d b/a b/b b/c
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
60 $ hg st -C
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
61 M b/a
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
62 M b/b
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
63 A b/c
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
64 a/c
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
65 R a/a
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
66 R a/b
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
67 R a/c
16094
0776a6cababe merge: don't use unknown()
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
68 ? a/d
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
69 $ hg ci -m "3 merge 2+1"
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
70 $ hg debugrename b/c
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
71 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
3733
9e67fecbfd16 merge: handle directory renames
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
72
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
73 $ hg co -C 1
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
74 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
75 $ hg merge --debug 2
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
76 searching for copies back to rev 1
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
77 unmatched files in local:
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
78 b/a
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
79 b/b
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
80 unmatched files in other:
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
81 a/c
16795
e9ae770eff1c merge: show renamed on one and deleted on the other side in debug output
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16094
diff changeset
82 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
18135
a6fe1b9cc68f copies: make debug messages more sensible
Siddharth Agarwal <sid0@fb.com>
parents: 16913
diff changeset
83 src: 'a/a' -> dst: 'b/a'
a6fe1b9cc68f copies: make debug messages more sensible
Siddharth Agarwal <sid0@fb.com>
parents: 16913
diff changeset
84 src: 'a/b' -> dst: 'b/b'
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
85 checking for directory renames
18135
a6fe1b9cc68f copies: make debug messages more sensible
Siddharth Agarwal <sid0@fb.com>
parents: 16913
diff changeset
86 discovered dir src: 'a/' -> dst: 'b/'
a6fe1b9cc68f copies: make debug messages more sensible
Siddharth Agarwal <sid0@fb.com>
parents: 16913
diff changeset
87 pending file src: 'a/c' -> dst: 'b/c'
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
88 resolving manifests
18605
bcf29565d89f manifestmerge: pass in branchmerge and force separately
Siddharth Agarwal <sid0@fb.com>
parents: 18360
diff changeset
89 branchmerge: True, force: False, partial: False
15625
efdcce3fd2d5 merge: make debug output easier to read
Martin Geisler <mg@aragost.com>
parents: 15447
diff changeset
90 ancestor: f9b20c0d4c51, local: 397f8b00a740+, remote: ce36d17b18fb
20944
5b8d5803d7b7 merge: keep destination filename as key in actions for merge with dir rename
Mads Kiilerich <madski@unity3d.com>
parents: 19133
diff changeset
91 b/c: local directory rename - get from a/c -> dg
5b8d5803d7b7 merge: keep destination filename as key in actions for merge with dir rename
Mads Kiilerich <madski@unity3d.com>
parents: 19133
diff changeset
92 updating: b/c 1/1 files (100.00%)
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
93 getting a/c to b/c
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
95 (branch merge, don't forget to commit)
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
96
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
97 $ echo a/* b/*
16094
0776a6cababe merge: don't use unknown()
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
98 a/d b/a b/b b/c
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
99 $ hg st -C
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
100 A b/c
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
101 a/c
16094
0776a6cababe merge: don't use unknown()
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
102 ? a/d
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
103 $ hg ci -m "4 merge 1+2"
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
104 created new head
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
105 $ hg debugrename b/c
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
106 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
107
23444
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
108 Local directory rename with conflicting file added in remote source directory
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
109 and untracked in local target directory.
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
110
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
111 $ hg co -qC 1
23464
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
112 $ echo target > b/c
23444
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
113 $ hg merge 2
23653
0297d8469350 merge: don't overwrite untracked file at directory rename target
Martin von Zweigbergk <martinvonz@google.com>
parents: 23476
diff changeset
114 b/c: untracked file differs
0297d8469350 merge: don't overwrite untracked file at directory rename target
Martin von Zweigbergk <martinvonz@google.com>
parents: 23476
diff changeset
115 abort: untracked files in working directory differ from files in requested revision
0297d8469350 merge: don't overwrite untracked file at directory rename target
Martin von Zweigbergk <martinvonz@google.com>
parents: 23476
diff changeset
116 [255]
0297d8469350 merge: don't overwrite untracked file at directory rename target
Martin von Zweigbergk <martinvonz@google.com>
parents: 23476
diff changeset
117 $ cat b/c
0297d8469350 merge: don't overwrite untracked file at directory rename target
Martin von Zweigbergk <martinvonz@google.com>
parents: 23476
diff changeset
118 target
0297d8469350 merge: don't overwrite untracked file at directory rename target
Martin von Zweigbergk <martinvonz@google.com>
parents: 23476
diff changeset
119 but it should succeed if the content matches
0297d8469350 merge: don't overwrite untracked file at directory rename target
Martin von Zweigbergk <martinvonz@google.com>
parents: 23476
diff changeset
120 $ hg cat -r 2 a/c > b/c
0297d8469350 merge: don't overwrite untracked file at directory rename target
Martin von Zweigbergk <martinvonz@google.com>
parents: 23476
diff changeset
121 $ hg merge 2
23444
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
123 (branch merge, don't forget to commit)
23653
0297d8469350 merge: don't overwrite untracked file at directory rename target
Martin von Zweigbergk <martinvonz@google.com>
parents: 23476
diff changeset
124 $ hg st -C
23444
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
125 A b/c
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
126 a/c
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
127 ? a/d
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
128
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
129 Local directory rename with conflicting file added in remote source directory
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
130 and committed in local target directory.
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
131
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
132 $ hg co -qC 1
23464
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
133 $ echo target > b/c
23444
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
134 $ hg add b/c
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
135 $ hg commit -qm 'new file in target directory'
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
136 $ hg merge 2
23476
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
137 merging b/c and a/c to b/c
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
138 warning: conflicts during merge.
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
139 merging b/c incomplete! (edit conflicts, then use 'hg resolve --mark')
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
140 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
141 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
142 [1]
23464
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
143 $ hg st -A
23476
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
144 M b/c
23444
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
145 a/c
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
146 ? a/d
23476
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
147 ? b/c.orig
23464
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
148 C b/a
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
149 C b/b
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
150 $ cat b/c
23476
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
151 <<<<<<< local: f1c50ca4f127 - test: new file in target directory
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
152 target
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
153 =======
23464
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
154 baz
23476
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
155 >>>>>>> other: ce36d17b18fb - test: 2 add a/c
39a12719ec65 merge: don't overwrite conflicting file in locally renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23475
diff changeset
156 $ rm b/c.orig
23464
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
157
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
158 Remote directory rename with conflicting file added in remote target directory
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
159 and committed in local source directory.
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
160
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
161 $ hg co -qC 2
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
162 $ hg st -A
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
163 ? a/d
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
164 C a/a
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
165 C a/b
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
166 C a/c
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
167 $ hg merge 5
23475
67f1d68861fb merge: don't ignore conflicting file in remote renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23464
diff changeset
168 merging a/c and b/c to b/c
67f1d68861fb merge: don't ignore conflicting file in remote renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23464
diff changeset
169 warning: conflicts during merge.
67f1d68861fb merge: don't ignore conflicting file in remote renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23464
diff changeset
170 merging b/c incomplete! (edit conflicts, then use 'hg resolve --mark')
67f1d68861fb merge: don't ignore conflicting file in remote renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23464
diff changeset
171 2 files updated, 0 files merged, 2 files removed, 1 files unresolved
67f1d68861fb merge: don't ignore conflicting file in remote renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23464
diff changeset
172 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
67f1d68861fb merge: don't ignore conflicting file in remote renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23464
diff changeset
173 [1]
23464
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
174 $ hg st -A
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
175 M b/a
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
176 M b/b
23475
67f1d68861fb merge: don't ignore conflicting file in remote renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23464
diff changeset
177 M b/c
23464
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
178 a/c
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
179 R a/a
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
180 R a/b
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
181 R a/c
73d4f6551798 merge: add test with conflicting file and remote directory rename
Martin von Zweigbergk <martinvonz@google.com>
parents: 23444
diff changeset
182 ? a/d
23475
67f1d68861fb merge: don't ignore conflicting file in remote renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23464
diff changeset
183 ? b/c.orig
23444
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
184 $ cat b/c
23475
67f1d68861fb merge: don't ignore conflicting file in remote renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23464
diff changeset
185 <<<<<<< local: ce36d17b18fb - test: 2 add a/c
23444
88629daa727b merge: demonstrate that directory renames can lose local file content
Martin von Zweigbergk <martinvonz@google.com>
parents: 21391
diff changeset
186 baz
23475
67f1d68861fb merge: don't ignore conflicting file in remote renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23464
diff changeset
187 =======
67f1d68861fb merge: don't ignore conflicting file in remote renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23464
diff changeset
188 target
67f1d68861fb merge: don't ignore conflicting file in remote renamed directory
Martin von Zweigbergk <martinvonz@google.com>
parents: 23464
diff changeset
189 >>>>>>> other: f1c50ca4f127 - test: new file in target directory
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
190
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
191 Second scenario with two repos:
3733
9e67fecbfd16 merge: handle directory renames
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
192
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
193 $ cd ..
13956
ffb5c09ba822 tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents: 12114
diff changeset
194 $ hg init r1
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
195 $ cd r1
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
196 $ mkdir a
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
197 $ echo foo > a/f
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
198 $ hg add a
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
199 adding a/f (glob)
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
200 $ hg ci -m "a/f == foo"
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
201 $ cd ..
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
202
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
203 $ hg clone r1 r2
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
204 updating to branch default
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
205 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
206 $ cd r2
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
207 $ hg mv a b
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
208 moving a/f to b/f (glob)
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
209 $ echo foo1 > b/f
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
210 $ hg ci -m" a -> b, b/f == foo1"
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
211 $ cd ..
3733
9e67fecbfd16 merge: handle directory renames
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
212
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
213 $ cd r1
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
214 $ mkdir a/aa
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
215 $ echo bar > a/aa/g
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
216 $ hg add a/aa
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
217 adding a/aa/g (glob)
12114
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
218 $ hg ci -m "a/aa/g"
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
219 $ hg pull ../r2
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
220 pulling from ../r2
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
221 searching for changes
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
222 adding changesets
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
223 adding manifests
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
224 adding file changes
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
225 added 1 changesets with 1 changes to 1 files (+1 heads)
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
226 (run 'hg heads' to see heads, 'hg merge' to merge)
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
227
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
228 $ hg merge
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
229 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
230 (branch merge, don't forget to commit)
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
231
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
232 $ hg st -C
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
233 M b/f
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
234 A b/aa/g
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
235 a/aa/g
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
236 R a/aa/g
0a6b2e21bc86 tests: merge the two test-rename-dir-merge* into one
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
237 R a/f
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16795
diff changeset
238
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16795
diff changeset
239 $ cd ..