Attic Extension
This extension is not distributed with Mercurial.
Author: Bill Barry (BillBarry)
Repository: https://bitbucket.org/Bill_Barry/hgattic
Overview
This module deals with a set of patches in the folder .hg/attic. At any time you can shelve your current working copy changes there or unshelve a patch from the folder.
Configuration
Enable the extension by adding following lines to your configuration file (hgrc):
[extensions] hgattic=/path/to/attic.py
Usage
The extension adds a couple of commands, all starting with attic- so that they are grouped together in hg help, but all have shorter aliases:
hg attic-shelve
Shelve will take the current changes to the working copy and create a patch in the attic:
hg shelve [name]
You need to supply a name for the patch when you first shelve it, but you can forget it if you are already working on a patch as, in that case, changes are added to the current patch.
This command comes with some options notable for setting meta-data on
the patch:
-m or --message |
Use <text> as the commit message |
-e or --edit |
Bring up an editor to supply the commit message |
-r or --refresh |
Refresh the current patch without stowing it away |
as well as some for setting the user and the date. See the command help for more details.
hg attic-unshelve
Unshelve is the mirrored partner to shelve
hg unshelve [name]
You need to supply a name if it isn't the same as the last patch you were working on. Ex:
... do some work hg shelve patch1 ... fix a bug hg ci -m "fixed bug" hg unshelve ... name is not needed here because it is implied to be patch1
vs.
... do some work hg shelve patch1 ... work on something else hg shelve patch2 ... switch back to patch1 hg unshelve patch1 ... name is needed here because it is implied to be patch2
hg attic-display
The attic command displays the list of patches in the attic:
hg attic
There are some options to change what it displays:
-c or --current |
Show information about the current shelf being worked on |
-d or --header |
Show information about a given patch by name |
Technical details
Restrictions on patches
Don't create a patch with a name that starts with a period. It will not be shown with the attic-display command (and it could conflict with special files in the attic). Any special file in the attic is expected to start with a period (this is reserved for future usage as well).
Versioning the attic directory
You can put the attic under revision control, just ignore files that start with a period. This is particularly useful for sharing patches with a group of people.
Special files
Currently there are two special files:
.applied |
contains the name of the current applied patch |
.current |
contains the name of the implied default patch |