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 6355611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:48:04+00:00 2026-05-24T22:48:04+00:00

I created a new repository, test-backout , and added a new file in it,

  • 0

I created a new repository, test-backout, and added a new file in it, file. I then made 4 commits, each time, appending the number of the commit to file using

echo [manually entered number] >> file
hg commit -m '[manually entered number]'

In effect, file had:

init
1
2
3

According to the hg book, if I run hg backout --merge 2, I should have:

init
1
3

but instead, it fails to merge and opens up my difftool (vimdiff), and I get 3 options:

init          | init          | init
1             | 1             |
2             |               |
3             |               |

I initially tried it with the --merge option, then again without it. My question now is, is there still a way for me to get:

init
1
3

did I just make a mistake or miss something, or am I stuck with those options?

  • 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-24T22:48:05+00:00Added an answer on May 24, 2026 at 10:48 pm

    A big factor in why you got the 3-way merge is that your context is too artificial, and I will get to that.

    If I take a 50-line text file and change a different part and commit each change, I won’t have to resolve conflicts. And what I mean is I have 4 changesets: rev 0 adds the file, revs 1, 2, and 3 each change one area of the file: the beginning, middle, or end.

    In this situation, when I do hg backout 2, it makes a reverse of rev 2 and merges those changes to my working directory, and when I commit, the graph is linear:

    @  backout 2
    |
    o  3
    |
    o  2
    |
    o  1
    |
    o  initial
    

    If I instead do hg backout 2 --merge, it automatically commits the backout as a child of the revision it is backing out, and then merges that with the tip, producing a branched graph after I commit the merge:

    @    merge
    |\
    | o  backout 2
    | |
    o |  3
    |/
    o    2
    |    
    o    1
    |    
    o    initial
    

    In both situations, I didn’t have to do any 3-way merging. The reason you don’t automatically get

    init
    1
    3
    

    and instead have to do a 3-way merge is that the changes are too close together. The context and changes in each changeset are completely overlapped (default number of lines of context for a diff chunk is 3 lines, which encompasses the entire file still in your 4th changeset).

    A similar example is if you had 3 changesets that each modified the same line. If you backed out the middle change like you’re doing here, you would still be presented with a 3-way merge that you’ll likely have to manually edit to get correct.

    By the way, behavior did change in 1.7, as attested by hg help backout:

    Before version 1.7, the behavior without –merge was equivalent to specifying –merge followed by “hg update –clean .” to cancel the merge and leave the child of REV as a head to be merged separately.

    However, I don’t think that’s quite what you suspected.

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

Sidebar

Related Questions

I a xampp setup for php. I have created a new repository at D:/xampp/htdocs/cart
I am new to Repository concept and get some questions. I have created simple
I created a new SharePoint portal for testing purposes using a manually added HOSTS
I've created an integration test to verify that a repository handles Concurrency correcly. If
I have this test [Fact] public void Get_if_item_is_not_in_cache_return_null_returns_true() { var repo = new Repository<IProduct>(
I am new to Mercurial and tried to push a test file to a
I am extremely new to SVN. I have created my own repository which is
I am using HgEclipse from here: http://www.javaforge.com/project/HGE I have created a new repository on
I created new remote git repository and already pushed something in there - first
My normal work flow to create a new repository with subversion is to create

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.