[PATCH]mq:a patch stores

Xiaofeng Ling xiaofeng.ling at intel.com
Wed Sep 14 01:03:39 CDT 2005

Chris Mason wrote:
> On Tue, 13 Sep 2005 23:11:00 +0800
> "Ling, Xiaofeng" <xiaofeng.ling at intel.com> wrote:
>>>I definitely understand why you want this, but I think there's a
>>>larger problem this patch doesn't solve.  You're getting into the
>>>general problem of series file management, where you might want to
>>>make a bunch of comments about a section of patches, disable a
>>>patch, or flag a patch with a special tag.    
>>Yes, I know the management feature can be very complex, so currently
>>for me, just a stores file is enough.This is just for putting some
>>independent patches temporally. I don't expect mq to manage a bunch
>>of patches that for different big features.
> I've updated http://www.serpentine.com/~cmason/ to the current hg tip
> and also included some of your patches.
> hg qnew -m was added, along with the series -v changes.  I didn't add
> the store patch, but did something slightly different instead.
> hg qseries -m  displays a sorted list of the files under .hg/patches
> that are not in the series file. hg qimport -e patch will take a patch
> under .hg/patches and add it to the series file.
> 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

diff -r 87b6675e9c4c contrib/mq
--- a/contrib/mq        Wed Sep 14 05:14:18 2005
+++ b/contrib/mq        Wed Sep 14 13:17:03 2005
@@ -561,7 +561,7 @@
                  for f in files:
                      fl = os.path.join(d, f)
                      if (fl not in self.series and fl != "status" and
-                       fl != "series"):
+                       fl != "series" and not re.match('^[.]', fl)):
              if list:

BTW, are you planing to work for the three way merge?
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?

More information about the Mercurial mailing list