SVN-like merging (contrib)
Sébastien Pierre
sebastien at xprima.com
Mon May 8 15:08:41 CDT 2006
Hi all,
I have implemented a small script that can be used to do SVN-like
merging with Mercurial. It offers the following features :
- Conflicts can be resolved in any order, at any time
- Conflicts can be individually and independently resolved
- Current version, parent version and newer version of each conflicting
file are saved as file.current, file.parent and file.newer.
To use it, you should first copy the script somewhere in your path.
After that, you should add/edit the following section in your ~/.hgrc
file:
[ui]
merge = /home/sebastien/Workspace/Mercurial/hg-svnmerge.py
Now, go into a repository when you want to merge a branches:
$ hg merge 43
merging file.py
Conflict 1:
file.py [58%]
parent file.py.parent
current file.py.current
newer file.py.newer
You will have a list of conflicts that you can review anytime with
"hg-svnmerge.py list" (they are stored in a `.hgconflicts` file):
$ hg-svnmerge.py list
Unresolved conflicts
====================
1:'file.py' 'file.py.newer'
No resolved conflicts
After that, you can resolve each conflict with `hg-svnmerge.py resolve`,
and optionally give the conflict number. If you want to undo the
conflict resolution, you can use the `hg-svnmerge.py undo` command.
When you're done, you can cleanup the files created by the utility by
running a `hg-svnmerge.py clean`.
NOTE: Commit is not yet implemented (it will prevent commiting before
every conflict is resolved), but you can of course use `hg commit`.
I hope this will be useful to some people here. Comments/suggestions are
welcome, especially on the command-line interface !
-- Sébastien
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hg-svnmerge.py
Type: text/x-python
Size: 13663 bytes
Desc: not available
Url : http://www.selenic.com/pipermail/mercurial/attachments/20060508/85a79391/hg-svnmerge.py
More information about the Mercurial
mailing list