Understanding mercurial.
Erik Bågfors
zindar at gmail.com
Sat Jul 30 07:59:46 CDT 2005
Hello
Just started to look into mercurial. I've been playing around and
using cvs, svn darcs, baz, bzr and now started to look at mercurial.
It look very very cool, so please don't take any of my comments below
wrong.
There are some things that I'm confused about.
Please note that I'm not using the latest and greatest hg, only
Mercurial version 0.6. So maybe some of these things are
fixed/implemented/different in the hg version of hg :)
1) Cherry-pick.
How do I cherry-pick changes from one branch to another? Is that even
possible? A quite common scenario for me is that we have a released
product, then keep developing that, then we find out a bug, want to
fix that, in the development tree, and backport it to the release
product tree (simply a patch release).
The only way I found was to export these changesets, which isn't very
convinient.
2) exporting more than one changeset
The only way I found is, hg export 100; hg export 101; hg export 102, etc.
3) Importing changesets and keeping summary committer etc,
Right now it seems to set "# HG changeset patch" as summary always.
What's the rationality behind this?
4) Merging sometimes creates two changesets with the same things in.
If I pull something that I need to merge with "update -m" I also need
to commit that change again and then I get two changesets with the
same information/change. I find this very strange. To understand
that i mean, this is what I did.
mkdir a
cd a
hg init
cp /etc/passwd .
hg commit -A -t 'added passwd'
cd ..
mkdir b
cd b
hg init
hg pull ../a
hg update
perl -i -pe s/games/spel/g passwd
hg diff
hg commit -t 'changed games to spel'
cd ../a
perl -i -pe s/nobody/ingen/g passwd
hg diff
hg commit -t 'changed nobody to ingen'
hg pull ../b
hg update
hg update -m
hg log passwd
hg export tip
hg export 2
tip (which is 3) and 2 are now the same. See the output from the
export commands.
5) renaming a file,
I know that hg doesn't have a "move" or "rename" command. But you can
use copy instead? Is this just a temporary thing? I expect that when I
rename a file in one branch, then pull in changes from another branch
where the file isn't jet renamed, hg should be able to put those
changes into the renamed file.
This is what I tried.
mkdir a
cd a
hg init
cp /etc/passwd .
hg commit -A -t 'added passwd'
cd ..
mkdir b
cd b
hg init
hg pull ../a
hg update
mv passwd password
hg copy passwd password
hg commit -A -t 'moved passwd to password'
cd ../a
perl -i -pe s/nobody/ingen/g passwd
hg commit -t 's/nobody/ingen/g'
cd ../b/
hg pull ../a
hg update -m
Then I get the following
remote changed passwd which local deleted
(k)eep or (d)elete? d
Traceback (most recent call last):
File "/usr/bin/hg", line 13, in ?
commands.run()
File "/usr/lib/python2.4/site-packages/mercurial/commands.py", line
750, in run
sys.exit(dispatch(sys.argv[1:]))
File "/usr/lib/python2.4/site-packages/mercurial/commands.py", line
812, in dispatch
return d()
File "/usr/lib/python2.4/site-packages/mercurial/commands.py", line
796, in <lambda>
d = lambda: i[0](u, repo, *args, **cmdoptions)
File "/usr/lib/python2.4/site-packages/mercurial/commands.py", line
654, in update
return repo.update(node, allow=merge, force=clean)
File "/usr/lib/python2.4/site-packages/mercurial/hg.py", line 1182, in update
os.unlink(f)
OSError: [Errno 2] No such file or directory: 'passwd'
Regards,
Erik
More information about the Mercurial
mailing list