Bug Report: hg {copy, rename, mv} with ".." to an empty directory fails with obscure error
Giorgos Keramidas
keramida at ceid.upatras.gr
Sun Oct 7 14:19:08 CDT 2007
On 2007-10-07 11:29, Mike Neuman <mcn at EnGarde.com> wrote:
> 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:
This is what happens when the current directory is whipped out under
your feet in both FreeBSD and Solaris too, so I'm not sure if there's an
eay way to fix this, other than running most Hg commands from the base
of the repository itself, as reported by $(hg root) :-(
> % 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