Friday, May 17, 2013

To destroy the most recent commit in Mercurial...

...you must do so at both the local HG Workbench and the repository itself. In both cases you will need the ID of the commit which may be seen enclosed in curly brackets from within HG Workbench at the "Show Repository Registry" pane at the center right of everything following "Changeset:" and the number for the changeset. The ID will look like a Guid that is only twelve characters long and has no dashes within it. For local fixes the .ini file at C:\Users\YOURNAMEHERE\mercurial.ini should look something like so to empower mq='s strip:

# Generated by TortoiseHg settings dialog
 
 
[ui]
merge = beyondcompare3
purge=
mq=
username = Tom Jaeschke <tom@example.com>
 
[tortoisehg]
vdiff = beyondcompare3
 
[extensions]
purge=
mq=

 
 

Shift-Right-Click on the root folder of the repository to get a popup menu with the "Open command window here" option in it which you should pick. At the command line type the following substituting the appropriate ID for the one I make up below:

hg strip 1a2b3c4d5678

 
 

Another way to accommodate the same thing without the strip is to update from a prior commit in the Workbench by right-clicking on a line item in the "Show Repository Registry" pane and picking "Update..." When offered a "Discard Local Changes" checkbox, you should check it before proceeding. In Fog Creek's Kiln you will need to destroy the commit at the repository by going to the repository's settings and then using the "Strip Changesets..." and "Delete Repository..." features at the bottom of the settings page. The former is likely more applicable than the later unless you are destroying the backup of a repository. For the former to work, you will need to enter the ID of the changeset.

No comments:

Post a Comment