[PATCH]mq:a patch stores

Chris Mason mason at suse.com
Wed Sep 14 07:05:10 CDT 2005

On Wed, 14 Sep 2005 14:03:39 +0800
Xiaofeng Ling <xiaofeng.ling at intel.com> wrote:
> > This doesn't allow you to work by patch number, but it seems more
> > generally useful to me.  Thanks for your input so far, please let me
> > know how this works out for you.
> > 
> > -chris
> It's ok for me.
> Series -m is what I original needed but later, I think keeping the 
> patches tracked in three level is more convient.(directory, series, 
> stores).  so I add a stores file.
> But if you think the stores file is not necessary.
> I'll just keep it for my own use.


> A little fix to hide .hg/patches/.hg directory when doing hg series -m

Thanks.  BTW, fl.startswith('.') will do the same as your re match, but
will be faster.

> BTW, are you planing to work for the three way merge?

I'll probably work on this over the next few weeks.  I don't expect to
make major progress before October though, so you're welcome to hack on

> This is what I think is the most attractive things for mq and can 
> improve the work efficency a lot.
> currently, when hg qpush fails, it still need lots of effort to edit
> one by one.
> By some initial thoughts, I think we need some place to track the 
> parents revision of the previous patches.
> possible solution:
> 1. add the top parents revid in series file for each patch when do
> hg qrefresh.(call it oldrev)
> 2 check out the destine revision(newrev) by hg co
> 3. when do hg push -m
>     1. get the "oldrev" for the top patch in series file, if empty, 
> warning or do normal patch.
>     2. get a file list of all the files that the top patch will
> change. 3. get these file of the oldrev to a temp directory by hg cat
>     4. apply the patch and keep .orig file
>     5. call "hgmerge" to all the files in the list,
>         hgmerge <newrev file> <oldrev file> <patched oldrev file>
> What do you think about it?

I was thinking of something similar, but we should be able to use two
heads to solve this.  Assuming you've got a queue of patches on rev A,
and want to update them to rev B:

1) hg checkout -C A
2) hg qpush -a
3) hg checkout -C B
4) mkdir .hg/tmppatches
5) for each revision from hg qapplied -v
       hg update -m revision
       hg commit -m 'merge with revision:patchname'
       diff from tip to parent in B head
       Create patch in .hg/tmppatches (preserving comments)

Once all revisions are merged, strip away all the new revisions from
heads A and B, and copy patches from .hg/tmppatches into .hg/patches.
While merging each patch, there might be patches that already exist in
some form in rev B, so there needs to be a prompt about keeping a given
revision once the merge is done.


More information about the Mercurial mailing list