Show More
@@ -803,10 +803,13 b' def docopy(ui, repo, pats, opts):' | |||
|
803 | 803 | def copy(abssrc, relsrc, target, exact): |
|
804 | 804 | abstarget = util.canonpath(repo.root, cwd, target) |
|
805 | 805 | reltarget = util.pathto(cwd, abstarget) |
|
806 | if not opts['force'] and repo.dirstate.state(abstarget) not in 'a?': | |
|
807 | ui.warn(_('%s: not overwriting - file already managed\n') % | |
|
808 |
|
|
|
809 |
|
|
|
806 | if os.path.exists(reltarget): | |
|
807 | if opts['force']: | |
|
808 | os.unlink(reltarget) | |
|
809 | else: | |
|
810 | ui.warn(_('%s: not overwriting - file exists\n') % | |
|
811 | reltarget) | |
|
812 | return | |
|
810 | 813 | if ui.verbose or not exact: |
|
811 | 814 | ui.status(_('copying %s to %s\n') % (relsrc, reltarget)) |
|
812 | 815 | if not opts['after']: |
@@ -58,3 +58,21 b' mkdir d2/d21' | |||
|
58 | 58 | hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21 |
|
59 | 59 | hg status |
|
60 | 60 | hg update -C |
|
61 | ||
|
62 | echo "# attempt to overwrite an existing file" | |
|
63 | echo "ca" > d1/ca | |
|
64 | hg rename d1/ba d1/ca | |
|
65 | hg status | |
|
66 | hg update -C | |
|
67 | ||
|
68 | echo "# forced overwrite of an existing file" | |
|
69 | echo "ca" > d1/ca | |
|
70 | hg rename --force d1/ba d1/ca | |
|
71 | hg status | |
|
72 | hg update -C | |
|
73 | ||
|
74 | echo "# replace a symlink with a file" | |
|
75 | ln -s ba d1/ca | |
|
76 | hg rename --force d1/ba d1/ca | |
|
77 | hg status | |
|
78 | hg update -C |
@@ -49,7 +49,7 b' R d1/d11/a1' | |||
|
49 | 49 | R d2/b |
|
50 | 50 | # move everything under directory d1 to existing directory d2, do not |
|
51 | 51 | # overwrite existing files (d2/b) |
|
52 |
d2/b: not overwriting - file |
|
|
52 | d2/b: not overwriting - file exists | |
|
53 | 53 | copying d1/d11/a1 to d2/d11/a1 |
|
54 | 54 | removing d1/d11/a1 |
|
55 | 55 | A d2/a |
@@ -91,3 +91,13 b' A d2/d21/a' | |||
|
91 | 91 | A d2/d21/a1 |
|
92 | 92 | R d1/a |
|
93 | 93 | R d1/d11/a1 |
|
94 | # attempt to overwrite an existing file | |
|
95 | d1/ca: not overwriting - file exists | |
|
96 | abort: no files to copy | |
|
97 | ? d1/ca | |
|
98 | # forced overwrite of an existing file | |
|
99 | A d1/ca | |
|
100 | R d1/ba | |
|
101 | # replace a symlink with a file | |
|
102 | A d1/ca | |
|
103 | R d1/ba |
General Comments 0
You need to be logged in to leave comments.
Login now