Bug Report: hg {copy, rename, mv} with ".." to an empty directory fails with obscure error

Mike Neuman mcn at EnGarde.com
Sun Oct 7 13:29:13 CDT 2007


I made a one line change to canonpath which seems to fix the problem, 
but introduce a new one:

*** /usr/local/lib/python2.4/site-packages/mercurial/util.py    Mon Jun 
25 19:18:18 2007
--- util.py     Sun Oct  7 11:24:01 2007
***************
*** 366,371 ****
--- 366,372 ----
       if not os.path.isabs(name):
           name = os.path.join(root, cwd, name)
       name = os.path.normpath(name)
+     name = os.path.realpath(name)
       if name != rootsep and name.startswith(rootsep):
           name = name[len(rootsep):]
           audit_path(name)

---

Now the problem is the directory you're in gets blown away right from 
under you. Semantically, this makes sense, but it's pretty confusing to 
the user:

% pwd
/usr/home/mcn/devel/mercurial-0.9.4/test-rep
% hg init .
% mkdir dir1 dir2
% touch dir1/file1
% hg add dir1/file1
% hg commit -m test
% cd dir1
% hg mv file1 ../dir2
% pwd
pwd: .: No such file or directory
% cd ..
/home



More information about the Mercurial mailing list