On 09/16/2016 08:08 AM, Simon King wrote:
On Fri, Sep 16, 2016 at 2:51 PM, Uwe Brauer <o...@mat.ucm.es> wrote:
BTW even if I used named branches instead of bookmarks there is no
simple way to export a whole branch? As in  in my example

  hg export --branch uwe -o mypatch.patch

Does not exist?

hg export -r 'uwe % master' -o mypatch.patch

works with bookmarks, and I'm pretty sure it'd work with named branches.

This is where it's really worth learning the revset language again
(https://selenic.com/hg/help/revsets). In this case, you want to
export revisions that are ancestors of your current working directory,
and aren't ancestors of "master".

ie. "ancestors(.) - ancestors(master)"

You can use the "::" operator as shorthand for the ancestors() function:

::. - ::master

You can also use the only() function:

only(::., ::master)

(You *might* be able to leave out the "::master" in that one, I'm not certain)

The % operator provides a much more direct translation: ". % master". Or, in this case, "uwe % master". If the % operator seems funky to you, you can also spell it "only(uwe,master)". It's equivalent to "::uwe - ::master".

If you've used a named branch, the branch() function would return all
the revisions on that branch.

Personally, I would not use a named branch for feature work like this. The branch is baked into the commits, so it could cause problems rebasing and things. Admittedly, I haven't used named branches at all, but my impression is that they only make sense for changes that you really do only want on that branch and never on another branch. In this case, you do not want that restriction; you want to be able to move these changes off of your feature branch (er, fork? head? bookmark?) and onto master or whatever the main development line is.

Plus, it seems like 'uwe % master' pretty easily gives you exactly what you want. I suppose if you fork another feature branch uwe2 off of uwe, things might get more complex -- or rather, you'd just need to specify what you mean. 'uwe2 % uwe' would give stuff only on uwe2 and not uwe, or 'uwe2 % master' could be used to apply all changes needed to get master to look like uwe2.

(As a side note, I only know about % because of questions on this list. I wish I'd known of it sooner, as I've had the exact same need and found it difficult to construct the appropriate revset.)

_______________________________________________
Mercurial mailing list
Mercurial@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial

Reply via email to