Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7620693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:59:53+00:00 2026-05-31T03:59:53+00:00

Using Mercurial, how can I bundle all changesets not known to be in another

  • 0

Using Mercurial, how can I bundle all changesets not known to be in another repository, including secret changesets?

I know bundle‘s --base option happens to include secret changesets, but I don’t want the --base behavior. (And it seems unusually weird that secret changesets are always included with --base but are never included without it. Shouldn’t there be a separate option?)

FYI, I commonly want to make a backup of all changesets which are only in my local repo before attempting a potentially dangerous history rewrite.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:59:55+00:00Added an answer on May 31, 2026 at 3:59 am

    You are correct that hg bundle will normally exclude secret changesets. This is because it’s just running the equivalent of hg outgoing and bundling these changesets.

    So some work-arounds:

    • If you know that you have at least one draft or public outgoing changeset as an ancestor of your secret changesets, then you can use

      $ hg bundle --base "parents(outgoing())"
      

      to get what you want. The outgoing() revset will pick the missing draft and public changesets and parents(outgoing() will be suitable bases. Since you use --base you get all descendants (public, draft, and secret) from these bases.

    • You could temporarily make your secret changesets draft, bundle, and then mark them secret again:

      $ secret=$(hg log --template "{rev} " -r "secret()"); \
        hg phase -d $secret; \
        hg bundle out.hg; \
        hg phase -f -s $secret
      

      (I use Zsh and there I had to use ${=secret} instead of $secret because Zsh doesn’t do word splitting on parameter expansion by default.)

      It’s important to chain the commands with ; instead of && since you’ll want to reset the phases regardless of what happens in the hg bundle call — passing wrong parameters to hg bundle should not mean that you lose all the information about the secret changesets. Note also that since secret changesets only have secret descendants, there’s no information loss with this technique.

      You can turn this into a shell alias:

      [alias]
      bundle-all = !secret=$(hg log --template "{rev} " -r "secret()");
                   hg phase -d $secret;
                   hg bundle $@;
                   hg phase -f -s $secret
      

      The $@ is expanded by Mercurial before the alias is invoked and this lets you insert the necessary arguments for hg bundle.

    Note that phase information cannot be stored in bundles — the bundle format has not been changed to accommodate it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Mercurial (hg), can you just hg backout all the commits you did for
Possible Duplicate: Git interoperability with a Mercurial Repository I'm using Git for all of
Problem on WindowsXP (likely will happen on all Win installs), first time using Mercurial.
Using Mercurial, we can commit one file by using hg commit file.rb or 1
How can I permanently forget T4 generated files from being version control using Mercurial?
Using Git or Mercurial, if the working directory is 1GB, then the local repository
I'm using Mercurial and after I pull changesets from a remote repo, I do
I have a web server which is using mercurial as the repository. Every day,
My team is using Mercurial, and I would like to know the relative contributions
I'm wondering if when using NetBeans and its Mercurial plugin I can only move/delete

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.