Differences between revisions 1 and 2
Revision 1 as of 2009-01-26 15:15:46
Size: 1063
Editor: BillBarry
Comment: quick paste of text to create page
Revision 2 as of 2009-01-26 16:08:13
Size: 3788
Editor: BillBarry
Comment: details for the attic extension
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Attic =
Attic is an extension that lets you shelve patches away and unshelve them to work on them.
You can clone it from here: [https://bitbucket.org/Bill_Barry/hgattic]
== Attic Extension ==
Line 5: Line 3:
This extension lets you work with a set of disjoint patches in a
Mercurial repository. With it you can task switch between many patches
in a single repository and easily share patch sets between
repositories.
'''This extension is not distributed with Mercurial.'''
Line 10: Line 5:
Known patches are represented as patch files in the .hg/attic
directory. Applied patches are changes in the working copy.
''Author: Bill Barry (BillBarry)''
Line 13: Line 7:
attic-shelve (shelve):
    store the current working copy changes in a patch in the attic and
    prepare to work on something else
Repository: https://bitbucket.org/Bill_Barry/hgattic
Line 17: Line 9:
attic-display (attic, ls):
    list the patches in the attic
    
attic-finish (sfinish):
    change a patch into a changeset (use commit, user and date info
    from patch)
    
attic-current (sactive):
    display the current patch being worked on
     
attic-unshelve (unshelve):
    activate a patch to work on
    
attic-rebuild (rebuild):
    update a patch with the current changes
=== 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. 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 ||

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-current ====

This command displays information about the currently applied patch or what the "default" implied patch is:
{{{hg sactive }}}

options:
||{{{-d}}} or {{{--header}}} || display patch header (meta-data) information ||

==== hg attic-display ====

The attic command displays the list of patches in the attic:
{{{hg attic }}}

==== hg attic-rebuild ====

Rebuild rebuilds the active patch without removing it from your working copy (this is a shortcut to doing hg shelve then hg unshelve right away).
{{{hg rebuild}}}

It has the same options as shelve.

==== hg attic-finish ====

This command is what you would use to finish a patch. It will remove a patch from the attic and commit it. The only reason you should use it anymore is to remove the patch without committing it, otherwise it is the same as hg commit.
{{{hg sfinish}}}

This command has mostly the same options as shelve and two additional options that shelve doesn't have:
||{{{-k}}} or {{{--keep}}} || keep the patch around after the commit ||
||{{{-n}}} or {{{--nocommit}}} || don't commit anything ||

=== 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 ||

----
CategoryExtension CategoryExtension

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. 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

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-current

This command displays information about the currently applied patch or what the "default" implied patch is: hg sactive 

options:

-d or --header

display patch header (meta-data) information

hg attic-display

The attic command displays the list of patches in the attic: hg attic 

hg attic-rebuild

Rebuild rebuilds the active patch without removing it from your working copy (this is a shortcut to doing hg shelve then hg unshelve right away). hg rebuild

It has the same options as shelve.

hg attic-finish

This command is what you would use to finish a patch. It will remove a patch from the attic and commit it. The only reason you should use it anymore is to remove the patch without committing it, otherwise it is the same as hg commit. hg sfinish

This command has mostly the same options as shelve and two additional options that shelve doesn't have:

-k or --keep

keep the patch around after the commit

-n or --nocommit

don't commit anything

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


CategoryExtension CategoryExtension

AtticExtension (last edited 2010-02-05 10:49:51 by Pierre-YvesDavid)