It would be nice if the graft command supported the -b option as a shortcut for selecting all changesets on a specific branch, like allowed by hg log. Note that the following entry in hgrc works quite nicely: [alias] graftb = graft "branch($1)"
Revsets exist precisely so we don't need to add dozens of selection options to each command.
Agreed. I see that indeed only log, incoming and outgoing seem to support -b. Maybe it is enough to add a sentence like this to graft --help: To copy all changes from a branch to the current branch, specify "branch(X)" as the REVISION argument. And/or maybe add a reference to revsets, like the one in log --help: See "hg help revisions" and "hg help revsets" for more about specifying revisions. Sometimes I still get confused when a branch name refers to the tip on that branch, to all changesets in a branch, or to all changes since the last common predecessor revision. A reminder like the above could help.
I don't think we want to document that particular use case. In general, if you want to import _all_ the changes from a branch, you want merge instead of graft.
Merge is not really useful for backporting. I should probably elaborate a bit on the reasons for that use case. Consider a typical project with released versions 1.0 and 2.0, and the next version 3.0 in active development. Assume their repository structure uses a single repository with named branches v1, v2, and the default branch. Now someone finds and fixes a bug on the v2 branch. Assume the bugfix is complicated, and so comprises several commits on a separate branch, say, bug_123. The developer merges his bugfix branch into the v2 and default branches, and everything is well. Some time later, someone realises that version 1.0 is also affected by that bug, and decides to backport the fix from the bug_123 branch. In that situation, merge is unhelpful: It would merge not only the changes on the bug_123 branch, but also all their ancestors on the v2 branch, which is its job. Here, graft comes to the rescue: It saves the developer from using diff+patch or manually porting the changes. Is that use case so unusual? I independently uphold the proposal to add a reference to revsets to the help message of graft. Should we split this issue in two?
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:29 EDT --- This bug was previously known as _bug_ 3361 at http://mercurial.selenic.com/bts/issue3361
Bulk close: no activity for >2 years -> WONTFIX
Bulk change recent WONTFIX -> new, more descriptive ARCHIVED state (sorry for the spam)