##// END OF EJS Templates
avoid to copy more than one file to the same destination file
Robin Farine -
r1514:faf46d81 default
parent child Browse files
Show More
@@ -790,6 +790,7 b' def docopy(ui, repo, pats, opts):'
790 790 cwd = repo.getcwd()
791 791 errors = 0
792 792 copied = []
793 targets = {}
793 794
794 795 def okaytocopy(abs, rel, exact):
795 796 reasons = {'?': _('is not managed'),
@@ -803,7 +804,12 b' def docopy(ui, repo, pats, opts):'
803 804 def copy(abssrc, relsrc, target, exact):
804 805 abstarget = util.canonpath(repo.root, cwd, target)
805 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 813 if opts['force']:
808 814 os.unlink(reltarget)
809 815 else:
@@ -829,6 +835,7 b' def docopy(ui, repo, pats, opts):'
829 835 (relsrc, inst.strerror))
830 836 errors += 1
831 837 return
838 targets[abstarget] = abssrc
832 839 repo.copy(abssrc, abstarget)
833 840 copied.append((abssrc, relsrc, exact))
834 841
@@ -76,3 +76,9 b' ln -s ba d1/ca'
76 76 hg rename --force d1/ba d1/ca
77 77 hg status
78 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 101 # replace a symlink with a file
102 102 A d1/ca
103 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