A tale of user-friendliness with "hg merge" and "hg rollback".
Rob Landley
rob at landley.net
Mon Oct 12 15:06:29 CDT 2009
I've been maintaining a little project in mercurial for a few years now, but I
always had people send me patches instead of doing pulls and dealing with
branches.
My friend mark did a one-line commit in his repository, and it seemed safe to
pull it. It was _one_line_. This made his commit the "tip" of my repository,
obscuring the last half-dozen commits I'd done.
So I tried to "hg merge". It complained I had outstanding commits. (What the
hell does that have to do with anything? I wanted it to combine the two
branches in the _repository_, which has nothing to do with my working store.
I just wanted the changes I'd done in the past week to be visible to others
again without having to re-commit them all.)
I looked at the "hg help merge" text again, but the only suggestion it offered
was the --force option. So I tried that. It created a "merge node", but
didn't commit it. Why?
What possible use could an "uncommitted merge" have? I wanted it to glue the
two branches of the repository together. How is this _not_ an atomic
operation? It went into some weird halfway state, what does that even _mean_?
Now it's got some uncommited abstract thing in its pending tray, which doesn't
exist in the filesystem, there's no path to it and no way to explicitly specify
it. And it wants me to commit it. Normally when I do "hg commit" with no
arguments it iterates through all the changed files in my local working store
and tries to apply them to the repository, which is exactly the behavior I've
been trying to _avoid_ all along here, that work is unfinished and not ready to
commit.
So now I just want to just get the repository back to a state where I
understood it, so I do an "hg rollback". Hoping this would not only kick out
this weird abstract uncommitted merge object, but maybe even remove the one
commit I'd pulled from Mark that was hiding all my recent work, which was
showing up as "tip".
Except that doing this seems to have destroyed the entire repository. After
the rollback, the entire repository was... gone. "hg log -v" listed nothing.
"hg branches" listed nothing. Even giving it explicit revision numbers well
back in the history ("hg log -r 800") produced _nothing_.
Luckily, I hadn't rsynced over the website copy yet, so I had a backup to
revert to. I had to delete all my local work, but the alternative seems to be
losing three years of commit history. (And as long as my local work _was_
deleted, the commit of the strange abstract merge commit seems to have since
gone fine.)
I still have the "this repository theoretically contains 843 commits and will
not show ANY of them" version, if you're interested in figuring out why it went
catatonic:
http://landley.net/firmware-weird.tbz
All this was fighting with the Mercurial 1.2.1 in Ubuntu 9.04.
Rob
--
Latency is more important than throughput. It's that simple. - Linus Torvalds
More information about the Mercurial
mailing list