Debian Codegraph @

tests/test-rename-rev.t

raw
1 $ hg init
2 $ mkdir d1 d1/d11 d2
3 $ echo d1/a > d1/a
4 $ echo d1/ba > d1/ba
5 $ echo d1/a1 > d1/d11/a1
6 $ echo d1/b > d1/b
7 $ echo d2/b > d2/b
8 $ hg add d1/a d1/b d1/ba d1/d11/a1 d2/b
9 $ hg commit -m "intial"
10
11
12 Test single file
13
14 # One recorded copy, one copy to record after commit
15 $ hg cp d1/b d1/c
16 $ cp d1/b d1/d
17 $ hg add d1/d
18 $ hg ci -m 'copy d1/b to d1/c and d1/d'
19 $ hg st -C --change .
20 A d1/c
21 d1/b
22 A d1/d
23 # Errors out without --after for now
24 $ hg cp --at-rev . d1/b d1/d
25 abort: --at-rev requires --after
26 [10]
27 # Errors out with non-existent source
28 $ hg cp -A --at-rev . d1/non-existent d1/d
29 d1/non-existent: no such file in rev 55d1fd85ef0a
30 abort: no files to copy
31 [10]
32 # Errors out with non-existent destination
33 $ hg cp -A --at-rev . d1/b d1/non-existent
34 abort: d1/non-existent: copy destination does not exist in 8a9d70fa20c9
35 [10]
36 # Successful invocation
37 $ hg cp -A --at-rev . d1/b d1/d
38 saved backup bundle to $TESTTMP/.hg/strip-backup/8a9d70fa20c9-973ae357-copy.hg
39 # New copy is recorded, and previously recorded copy is also still there
40 $ hg st -C --change .
41 A d1/c
42 d1/b
43 A d1/d
44 d1/b
45 # Should get helpful message if we try to copy or rename after commit
46 $ hg cp --forget --at-rev . d1/d
47 saved backup bundle to $TESTTMP/.hg/strip-backup/3f7c325d3f9e-46f377bb-uncopy.hg
48 $ hg cp d1/b d1/d
49 d1/d: not overwriting - file already committed
50 ('hg copy --at-rev .' to record the copy in the parent of the working copy)
51 [1]
52 $ hg mv d1/b d1/d
53 d1/d: not overwriting - file already committed
54 ('hg rename --at-rev .' to record the rename in the parent of the working copy)
55 [1]
56
57 Test moved file (not copied) using 'hg cp' command
58
59 $ hg co 0
60 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
61 $ mv d1/b d1/d
62 $ hg rm -A d1/b
63 $ hg add d1/d
64 $ hg ci -m 'move d1/b to d1/d'
65 created new head
66 $ hg cp -A --at-rev . d1/b d1/d
67 saved backup bundle to $TESTTMP/.hg/strip-backup/519850c3ea27-153c8fbb-copy.hg
68 $ hg st -C --change .
69 A d1/d
70 d1/b
71 R d1/b
72
73 Test moved file (not copied) using 'hg mv' command
74
75 $ hg co 0
76 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
77 $ mv d1/b d1/d
78 $ hg rm -A d1/b
79 $ hg add d1/d
80 $ hg ci -m 'move d1/b to d1/d'
81 created new head
82 $ hg mv -A --at-rev . d1/b d1/d
83 saved backup bundle to $TESTTMP/.hg/strip-backup/519850c3ea27-153c8fbb-copy.hg
84 $ hg st -C --change .
85 A d1/d
86 d1/b
87 R d1/b
88
89 Test moved file (not copied) for which source still exists
90
91 $ hg co 0
92 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
93 $ cp d1/b d1/d
94 $ hg add d1/d
95 $ hg ci -m 'copy d1/b to d1/d'
96 created new head
97 $ hg mv -A --at-rev . d1/b d1/d
98 saved backup bundle to $TESTTMP/.hg/strip-backup/c8d0f6bcf7ca-1c9bb53e-copy.hg
99 $ hg st -C --change .
100 A d1/d
101 d1/b
102
103 Test using directory as destination
104
105 $ hg co 0
106 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
107 $ cp -R d1 d3
108 $ hg add d3
109 adding d3/a
110 adding d3/b
111 adding d3/ba
112 adding d3/d11/a1
113 $ hg ci -m 'copy d1/ to d3/'
114 created new head
115 $ hg cp -A --at-rev . d1 d3
116 abort: d3: --at-rev does not support a directory as destination
117 [10]
118