doubt regarding mercurial queues

Steve Borho steve at borho.org
Wed Oct 17 16:39:53 CDT 2007


On Thu, 2007-10-18 at 02:39 +0530, Amit Upadhyay wrote:
> Hi,
> 
> I read the following on
> http://www.germane-software.com:8080/ser/aikido/life-with-mercurial:
> 
> Well, with Mercurial, I use MQ to manage the patch. I created an mq
> patch called build_cgal_on_linux, applied my changes, and call hg
> qrefresh. This causes my changes to be associated with the patch. Now
> the next time I commit, Mercurial ignores the changes, so they don't
> get checked in. When I share changes, build_cgal_on_linux doesn't get
> shared. 
> 
> 
> Here is how I am trying to do it:
> 
> C:\Documents and Settings\amitu\tmp\v>cat readme.txt 
> initial readme
> 
> 
> more work done.
> 
> third day
> 
> fourth day
> 
> C:\Documents and Settings\amitu\tmp\v>hg qseries
> 
> C:\Documents and Settings\amitu\tmp\v>hg qnew local.patch
> 
> C:\Documents and Settings\amitu\tmp\v>vim readme.txt
> 
> C:\Documents and Settings\amitu\tmp\v>cat readme.txt
> initial readme -- this change i do not want to send upstream
> 
> 
> more work done. 
> 
> third day
> 
> fourth day
> 
> C:\Documents and Settings\amitu\tmp\v>hg qrefresh
> 
> C:\Documents and Settings\amitu\tmp\v>cat readme.txt
> initial readme -- this change i do not want to send upstream 
> 
> 
> more work done.
> 
> third day
> 
> fourth day
> 
> 
> this change i do want to send upstream
> 
> C:\Documents and Settings\amitu\tmp\v>hg qct 
> 
> 
> I was hoping that now mercurial will ignore the change in first line,
> and let me commit the last line. Mercurial did detect the two changes
> as different, but is not letting me commit, here is what I get:
> 
> readme.txt has changes recorded in the patch, and further changes in
> the working directory 
> If reverted, only the working directory changes will be removed.  
> If you refresh without this file, all changes will be left in your working directory.
> Working Directory Diffs
> 
> diff -r 86e77a3b993b readme.txt
> --- a/readme.txt	Thu Oct 18 02:31:16 2007 +0530
> +++ b/readme.txt	Thu Oct 18 02:33:24 2007 +0530
> @@ -6,3 +6,6 @@ third day
> third day
> fourth day
> +
> +
> +this change i do want to send upstream
> Patch Diffs
> 
> diff -r 062d4651a83d -r 86e77a3b993b readme.txt
> --- a/readme.txt	Thu Oct 18 00:37:51 2007 +0530
> +++ b/readme.txt	Thu Oct 18 02:31:16 2007 +0530
> @@ -1,4 +1,4 @@ initial readme
> -initial readme
> +initial readme -- this change i do not want to send upstream
> more work done.
> 
> 
> And the only option for me there is "Refresh Patch". 
> 
> 
> C:\Documents and Settings\amitu\tmp\v>hg ci
> abort: cannot commit over an applied mq patch

This is the key message.  When a patch is applied, you cannot make a
normal commit on top of it.  Qct is enforcing this limitation of MQ, so
it only allows you to refresh the existing patch with the current
contents of your working directory.

> C:\Documents and Settings\amitu\tmp\v>hg qpop
> abort: local changes found, refresh first 

Yep, you have changes in your working directory that are not in a patch,
so MQ is not letting you pop the top patch.  Similar to the way it won't
let you 'hg update' when you have local changes.

What you probably want to do it create a new patch with these extra
changes:

hg qnew -f more-changes.txt

The top patch could then be distributed separately (via export) or the
patches could be re-ordered.  Only the base patch of a patch queue can
ever be converted into a changeset via qdel -r.

Note that what you're doing could be problematic since the second patch
may depend on context from the first patch, so it may not apply cleanly
on an unpatched repository.

-- 
Steve Borho (steve at borho.org)
http://www.borho.org/~steve/steve.asc
Key fingerprint = 2D08 E7CF B624 624C DE1F  E2E4 B0C2 5292 F2C6 2C8C



More information about the Mercurial mailing list