[issue2748] "hg up x" works from the parent dir when the dir 'x' has an 'x' branch

Ezio Melotti bugs at mercurial.selenic.com
Sat Apr 2 18:12:18 UTC 2011


New submission from Ezio Melotti <ezio.melotti at gmail.com>:

Mercurial seems to get confused in this situation:
I have a repo with a few branches:
wolf at hp:~/dev/py/unittest2$ hg branches
default                      429:ba7ee7f6aa37
plugins                      412:d626ef45b357
python2.3                    251:8beb2ea7d0be

I create a clone with the same name of one of the branches (e.g. plugins):
wolf at hp:~/dev/py/unittest2$ cd ..
wolf at hp:~/dev/py$ hg clone unittest2 plugins
updating to branch default
38 files updated, 0 files merged, 0 files removed, 0 files unresolved

*Without* moving in the new clone, I do "hg up plugins" and Mercurial
changes branch to 'plugins' inside the 'plugins' dir:
wolf at hp:~/dev/py$ hg up plugins
49 files updated, 0 files merged, 0 files removed, 0 files unresolved
wolf at hp:~/dev/py$ cd plugins/
wolf at hp:~/dev/py/plugins$ hg branch
plugins

This doesn't work when there's no dir with the given name:
wolf at hp:~/dev/py$ hg up default
abort: There is no Mercurial repository here (.hg not found)!

Or when there's a dir with the given name, but that doesn't have a branch
with the same:
wolf at hp:~/dev/py$ hg up unittest2
abort: unknown revision 'unittest2'!

I would expect this to give the "abort: There is no Mercurial repository
here (.hg not found)!" error in both the cases instead.

I noticed this because I usually keep a dir for each branch (with the same
name), and when I create a new clone and do hg up <branch> to change branch
forgetting to cd in the dir, I get "0 files updated, 0 files merged, 0 files
removed, 0 files unresolved" because it's trying to update the dir 'branch'
to the branch 'branch'.

----------
messages: 15956
nosy: ezio.melotti
priority: bug
status: unread
title: "hg up x" works from the parent dir when the dir 'x' has an 'x' branch

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2748>
____________________________________________________


More information about the Mercurial-devel mailing list