Folding is the act of combining multiple local commits into a single revision to push.
Clone your repository
Before attempting anything here you should clone your repository. This can be done easily in TortoiseHG by right-clicking your hg directory and selecting “Clone a repository”. Seriously, do this.
Make sure Mercurial.ini file in your user home dirctory (i.e. C:\Documents and Settings\rdis\Mercurial.ini) has the MQ extension enabled:
[extensions] rebase = mq = # allows to do qstatus and will show changes for last patch [alias] qstatus = status --rev -2:. # ensures use git format for patches, which handles binaries better [diff] git=1 [defaults] qdiff = --git qnew = --git qimport = --git qrefresh = --git
All changes to be folded must be committed locally
- Make sure that “Link with Editor” is disabled in Eclipse
- Open Mercurial Patch queue view in Eclipse (Window->show view->other->mercurial->mercurial patch view
- Click qimport
- Check “place existing revisions under mq control”
- Select the revisions to be folded
- Click finish
- Select the first changeset
- Click on ‘qpop’ to unapply the subsequent changes
- All revisions except the first should now show as ‘UNAPPLIED’
- Select all ‘UNAPPLIED’ changesets
- Click qfold
- Update the commit messages
- By default, the comment for the revision is all of the comments of the combined revisions separated by a line separator.
- To create a new comment for the folded revision, go to the command line and type ‘hg qrefresh -e’, type the new comment, and save the file
C:\RDIS\workspace_hg_tip\hg>hg qrefresh -e
- Commit the changes
- Go to command line and run the following command from the repository directory
C:\RDIS\workspace_hg_tip\hg>hg qfinish -a
- All your changes have now been folded locally so you can push them to the central repo.