annotate tests/test-merge-remove.t @ 13826:e574207e3bcd

url: refactor util.drop_scheme() and hg.localpath() into url.localpath() This replaces util.drop_scheme() with url.localpath(), using url.url for parsing instead of doing it on its own. The function is moved from util to url to avoid an import cycle. hg.localpath() is removed in favor of using url.localpath(). This provides more consistent behavior between "hg clone" and other commands. To preserve backwards compatibility, URLs like bundle://../foo still refer to ../foo, not /foo. If a URL contains a scheme, percent-encoded entities are decoded. When there's no scheme, all characters are left untouched. Comparison of old and new behaviors: URL drop_scheme() hg.localpath() url.localpath() === ============= ============== =============== file://foo/foo /foo foo/foo /foo file://localhost:80/foo /foo localhost:80/foo /foo file://localhost:/foo /foo localhost:/foo /foo file://localhost/foo /foo /foo /foo file:///foo /foo /foo /foo file://foo (empty string) foo / file:/foo /foo /foo /foo file:foo foo foo foo file:foo%23bar foo%23bar foo%23bar foo#bar foo%23bar foo%23bar foo%23bar foo%23bar /foo /foo /foo /foo Windows-related paths on Windows: URL drop_scheme() hg.localpath() url.localpath() === ============= ============== =============== file:///C:/foo C:/C:/foo /C:/foo C:/foo file:///D:/foo C:/D:/foo /D:/foo D:/foo file://C:/foo C:/foo C:/foo C:/foo file://D:/foo C:/foo D:/foo D:/foo file:////foo/bar //foo/bar //foo/bar //foo/bar //foo/bar //foo/bar //foo/bar //foo/bar \\foo\bar //foo/bar //foo/bar \\foo\bar Windows-related paths on other platforms: file:///C:/foo C:/C:/foo /C:/foo C:/foo file:///D:/foo C:/D:/foo /D:/foo D:/foo file://C:/foo C:/foo C:/foo C:/foo file://D:/foo C:/foo D:/foo D:/foo file:////foo/bar //foo/bar //foo/bar //foo/bar //foo/bar //foo/bar //foo/bar //foo/bar \\foo\bar //foo/bar //foo/bar \\foo\bar For more information about file:// URL handling, see: http://www-archive.mozilla.org/quality/networking/testing/filetests.html Related issues: - issue1153: File URIs aren't handled correctly in windows This patch should preserve the fix implemented in 2770d03ae49f. However, it goes a step further and "promotes" Windows-style drive letters from being interpreted as host names to being part of the path. - issue2154: Cannot escape '#' in Mercurial URLs (#1172 in THG) The fragment is still interpreted as a revision or a branch, even in paths to bundles. However, when file: is used, percent-encoded entities are decoded, so file:test%23bundle.hg can refer to test#bundle.hg ond isk.
author Brodie Rao <brodie@bitheap.org>
date Wed, 30 Mar 2011 20:03:05 -0700
parents 0a63e91c519d
children e4d7cbc94219
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12260
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
1 $ hg init
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
2
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
3 $ echo foo > foo
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
4 $ echo bar > bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
5 $ hg ci -qAm 'add foo bar'
6297
fed1a9c22076 dirstate.remove: during merges, remember the previous file state
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
6
12260
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
7 $ echo foo2 >> foo
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
8 $ echo bleh > bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
9 $ hg ci -m 'change foo bar'
6297
fed1a9c22076 dirstate.remove: during merges, remember the previous file state
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
10
12260
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
11 $ hg up -qC 0
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
12 $ hg mv foo foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
13 $ echo foo1 > foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
14 $ hg cat foo >> foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
15 $ hg ci -m 'mv foo foo1'
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
16 created new head
6297
fed1a9c22076 dirstate.remove: during merges, remember the previous file state
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
17
12260
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
18 $ hg merge
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
19 merging foo1 and foo to foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
20 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
21 (branch merge, don't forget to commit)
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
22
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
23 $ hg debugstate --nodates
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
24 n 0 -2 bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
25 m 644 14 foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
26 copy: foo -> foo1
6297
fed1a9c22076 dirstate.remove: during merges, remember the previous file state
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
27
12260
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
28 $ hg st -q
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
29 M bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
30 M foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
31
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
32
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
33 Removing foo1 and bar:
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
34
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
35 $ cp foo1 F
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
36 $ cp bar B
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
37 $ hg rm -f foo1 bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
38
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
39 $ hg debugstate --nodates
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
40 r 0 -2 bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
41 r 0 -1 foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
42 copy: foo -> foo1
6297
fed1a9c22076 dirstate.remove: during merges, remember the previous file state
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
43
12260
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
44 $ hg st -qC
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
45 R bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
46 R foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
47
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
48
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
49 Re-adding foo1 and bar:
6297
fed1a9c22076 dirstate.remove: during merges, remember the previous file state
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
50
12260
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
51 $ cp F foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
52 $ cp B bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
53 $ hg add -v foo1 bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
54 adding bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
55 adding foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
56
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
57 $ hg debugstate --nodates
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
58 n 0 -2 bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
59 m 644 14 foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
60 copy: foo -> foo1
6298
53cbb33e1269 normallookup: during merges, restore the state saved by remove
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6297
diff changeset
61
12260
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
62 $ hg st -qC
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
63 M bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
64 M foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
65 foo
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
66
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
67
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
68 Reverting foo1 and bar:
6299
653ddd1d7cd7 revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6298
diff changeset
69
12260
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
70 $ hg revert -vr . foo1 bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
71 saving current version of bar as bar.orig
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
72 reverting bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
73 saving current version of foo1 as foo1.orig
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
74 reverting foo1
6299
653ddd1d7cd7 revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6298
diff changeset
75
12260
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
76 $ hg debugstate --nodates
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
77 n 0 -2 bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
78 m 644 14 foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
79 copy: foo -> foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
80
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
81 $ hg st -qC
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
82 M bar
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
83 M foo1
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
84 foo
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
85
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
86 $ hg diff
0a63e91c519d tests: unify test-merge-remove
Adrian Buehlmann <adrian@cadifra.com>
parents: 6299
diff changeset
87