Mercurial - How to pull all revisions on all branches up to a specific point?

I guess I must have misunderstood the author of this post when he said:

hg pull -r X -f repo  # ... will give me all changesets up to X

Because when I did that (in a freshly-created repository), I only got those changesets that were ancestors of the branch that revision X is on.

What I wanted was all the changesets that had been committed to the remote repo up to and including X, chronologically. In other words, in addition to the branch that X is on (and its ancestors), I also wanted all other branches (including closed branches) committed before X that hadn't been merged to X's branch.

How would I express the command to do that?

BTW, in this particular repo, there are closed branches that have names that are identical to currently open/active branches, so if the solution involves enumerating all the branch names (which would be tedious, but do-able), it would still need to get the closed occurrences of such branches as well as the open ones.

(For completeness I suppose I should also say that I ran the command from the command-line of TortoiseHG 2.7 on Windows, in case the behavior of hg pull that I've described above isn't what I should have expected.)


You can't do that on pull in a single command. "Chronologically" means a lot less than you think it might. Anyone can do a commit with any timestamp they want, so the dates aren't good selectors. If you mean "with an earlier revision number" those too can change from repo to repo, so pulling all revisions with a revision number lower than N could give different results for different invocations.

If you want to try the revision-number-based version anyway, you'd probably have your best luck pulling everything to a trash repo locally and then pushing only what you want to a new local repository:

hg clone http://remotehost/path local-clone   # clones everything
hg init another-local-clone
hg push --repository local-clone --rev '0:X' another-local-clone

after that another-local-clone will have all the changesets whose revision numbers is X or lower in local-clone, which is (but isn't guaranteed to be) the same as the remote clone

If that seems awkward it's because "committed before" isn't a terribly useful concept in DVCS land -- it assumes a linearity that neither git not Mercurial consider important.

Need Your Help

Magento Cronjob for updating stock

magento magento-1.7

after a long search I've finally decided to ask:

Obtain value from HBase table by key

mapreduce hive hbase apache-pig apache-spark-sql

There is a HBase table with tens of billions records where a key is a line of 40 bytes. And also there is a list of hundreds of thousands keys. I need to get all records with this keys and return v...