comparison mercurial/cmdutil.py @ 16542:e596a631210e stable

dirstate: preserve path components case on renames (issue3402) The original issue was something like: $ hg init repo $ cd repo $ mkdir D $ echo a > D/a $ hg ci -Am adda adding D/a $ mv D temp $ mv temp d $ echo b > d/b $ hg add d/b adding D/b $ hg ci -m addb $ hg mv d/b d/c moving D/b to d/c $ hg st A d/c R D/b Here we expected: A D/c R D/b the logic being we try to preserve case of path components already known in the dirstate. This is fixed by the current patch. Note the following stories are not still not supported: Changing directory case $ hg mv D d moving D/a to D/D/a moving D/b to D/D/b $ hg st A D/D/a A D/D/b R D/a R D/b or: $ hg mv D/* d D/a: not overwriting - file exists D/b: not overwriting - file exists And if they were, there are probably similar issues with diffing/patching.
author Patrick Mezard <patrick@mezard.eu>
date Sat, 28 Apr 2012 20:29:21 +0200
parents 55982f62651f
children ebf6d38c9063
comparison
equal deleted inserted replaced
16541:bb3334806ace 16542:e596a631210e
266 # abssrc: hgsep 266 # abssrc: hgsep
267 # relsrc: ossep 267 # relsrc: ossep
268 # otarget: ossep 268 # otarget: ossep
269 def copyfile(abssrc, relsrc, otarget, exact): 269 def copyfile(abssrc, relsrc, otarget, exact):
270 abstarget = scmutil.canonpath(repo.root, cwd, otarget) 270 abstarget = scmutil.canonpath(repo.root, cwd, otarget)
271 if '/' in abstarget:
272 # We cannot normalize abstarget itself, this would prevent
273 # case only renames, like a => A.
274 abspath, absname = abstarget.rsplit('/', 1)
275 abstarget = repo.dirstate.normalize(abspath) + '/' + absname
271 reltarget = repo.pathto(abstarget, cwd) 276 reltarget = repo.pathto(abstarget, cwd)
272 target = repo.wjoin(abstarget) 277 target = repo.wjoin(abstarget)
273 src = repo.wjoin(abssrc) 278 src = repo.wjoin(abssrc)
274 state = repo.dirstate[abstarget] 279 state = repo.dirstate[abstarget]
275 280