Show More
@@ -790,6 +790,7 b' def docopy(ui, repo, pats, opts):' | |||||
790 | cwd = repo.getcwd() |
|
790 | cwd = repo.getcwd() | |
791 | errors = 0 |
|
791 | errors = 0 | |
792 | copied = [] |
|
792 | copied = [] | |
|
793 | targets = {} | |||
793 |
|
794 | |||
794 | def okaytocopy(abs, rel, exact): |
|
795 | def okaytocopy(abs, rel, exact): | |
795 | reasons = {'?': _('is not managed'), |
|
796 | reasons = {'?': _('is not managed'), | |
@@ -803,7 +804,12 b' def docopy(ui, repo, pats, opts):' | |||||
803 | def copy(abssrc, relsrc, target, exact): |
|
804 | def copy(abssrc, relsrc, target, exact): | |
804 | abstarget = util.canonpath(repo.root, cwd, target) |
|
805 | abstarget = util.canonpath(repo.root, cwd, target) | |
805 | reltarget = util.pathto(cwd, abstarget) |
|
806 | reltarget = util.pathto(cwd, abstarget) | |
806 | if os.path.exists(reltarget): |
|
807 | prevsrc = targets.get(abstarget) | |
|
808 | if prevsrc is not None: | |||
|
809 | ui.warn(_('%s: not overwriting - %s collides with %s\n') % | |||
|
810 | (reltarget, abssrc, prevsrc)) | |||
|
811 | return | |||
|
812 | elif os.path.exists(reltarget): | |||
807 | if opts['force']: |
|
813 | if opts['force']: | |
808 | os.unlink(reltarget) |
|
814 | os.unlink(reltarget) | |
809 | else: |
|
815 | else: | |
@@ -829,6 +835,7 b' def docopy(ui, repo, pats, opts):' | |||||
829 | (relsrc, inst.strerror)) |
|
835 | (relsrc, inst.strerror)) | |
830 | errors += 1 |
|
836 | errors += 1 | |
831 | return |
|
837 | return | |
|
838 | targets[abstarget] = abssrc | |||
832 | repo.copy(abssrc, abstarget) |
|
839 | repo.copy(abssrc, abstarget) | |
833 | copied.append((abssrc, relsrc, exact)) |
|
840 | copied.append((abssrc, relsrc, exact)) | |
834 |
|
841 |
@@ -76,3 +76,9 b' ln -s ba d1/ca' | |||||
76 | hg rename --force d1/ba d1/ca |
|
76 | hg rename --force d1/ba d1/ca | |
77 | hg status |
|
77 | hg status | |
78 | hg update -C |
|
78 | hg update -C | |
|
79 | ||||
|
80 | echo "# do not copy more than one source file to the same destination file" | |||
|
81 | mkdir d3 | |||
|
82 | hg rename d1/* d2/* d3 | |||
|
83 | hg status | |||
|
84 | hg update -C |
@@ -101,3 +101,15 b' R d1/ba' | |||||
101 | # replace a symlink with a file |
|
101 | # replace a symlink with a file | |
102 | A d1/ca |
|
102 | A d1/ca | |
103 | R d1/ba |
|
103 | R d1/ba | |
|
104 | # do not copy more than one source file to the same destination file | |||
|
105 | copying d1/d11/a1 to d3/d11/a1 | |||
|
106 | d3/b: not overwriting - d2/b collides with d1/b | |||
|
107 | removing d1/d11/a1 | |||
|
108 | A d3/a | |||
|
109 | A d3/b | |||
|
110 | A d3/ba | |||
|
111 | A d3/d11/a1 | |||
|
112 | R d1/a | |||
|
113 | R d1/b | |||
|
114 | R d1/ba | |||
|
115 | R d1/d11/a1 |
General Comments 0
You need to be logged in to leave comments.
Login now