ann: attic extension (alpha quality), request for help

Bill Barry after.fallout at gmail.com
Tue Jan 13 13:07:34 CST 2009


My biggest problems with mq are:
1. that I have to manually move patches around a lot in the series file
2. it is hard to share sets of patches around with my coworkers because 
they also need to move patches around in the series file (either we can 
push/pull to each others mq repo and deal with conflicts in series or we 
can ignore the series file and manually add or remove files to it)

In light of these problems I have come up with an extension that better 
fits my working style. I have just created a non-interactive shelving 
extension which I am calling attic (it probably doesn't play well with 
the interactive shelving extension hgshelve). Its purpose is to manage a 
set of patches (as opposed to mq which manages a series of patches) one 
at a time. It plays well with mq also, so that if you do need to deal 
with a patch series you still can do so in mq (attic works right over 
top of mq and you can manually move patches between them).

As of right now pretty much all of it seems to work except the finish 
command (and I am confused at why it isn't working). Could somebody 
possibly take a look at it?

Also I'd like to write actual test cases around this but I really don't 
know what I am doing here in Python.

http://bitbucket.org/Bill_Barry/hgattic/changeset/74444dd0c72d/#chg-attic.py

 From the doc header:

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.

Known patches are represented as patch files in the .hg/attic
directory.  Applied patches are changes in the working copy.

Common tasks (use "hg help command" for more details):

attic-shelve (shelve):
    store the current working copy changes in a patch in the attic and
    prepare to work on something else

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
   

Potential future work:
* fix bugs
* regex/glob option to attic-display to filter out files from the list
* create commands to do basic work with the attic repo (commit, push,
  pull, addrem, init, ...)
* override import to provide default path for patches from attic (so
  you don't have to unshelve before finishing them or manually provide
  the path to import)
* if mq is in use:
  * override qnew to move an attic patch into mq
  * provide a new command to pull patches out of mq and into attic
    (perhaps just "hg shelve -q")   
  * possibly allow shelving/unshelving entire queue series into
    folders in attic:
   
    "hg shelve -q foldername --all" would:
    1. pop all patches in mq
    2. create folder "foldername" in attic
    3. move all patches and the series file into this folder
   
    "hg shelve -q foldername --applied"
    1. split series into two parts: applied and unapplied
    2. pop all patches in mq
    3. create folder "foldername" in attic
    4. move all patches in applied list into the attic and
       remove them from series
   
    "hg shelve -q foldername --unapplied"
    (same thing with unapplied patches)
   
    "hg unshelve -q foldername"
    1. "hg shelve -q defaultfolder --all"
    2. copy contents of foldername into the patches dir
* provide new commands for dealing with patches like import/export (don't
  know if this is really necessary)


More information about the Mercurial mailing list