Reputation: 5377
I'm trying to learn Mercurial but am struggling to figure out how to deal with the situation of a central repository with two clones, and changes simultaneously made in the clones. Here's what I did:
1.I created a repository in a folder (central
), and then cloned it to two other folders (al
, bob
).
2. Added a file (text.txt) to al
, committed it
3. Changed the file in al
, committed it
4. Pushed al
to central
5. Pulled central
into bob
, updated
6. Changed file in bob
, committed, pushed to central
7. Pulled central
into al
, updated
Here's the part where my question comes in ...
8. I changed a file in al
, committed AND
9. changed the same file in bob
, committed
10. I pushed bob
to central
11. Now, when I pull central
to al
I get the message
added 1 changesets with 1 changes to 1 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge)
I understand what's going on re: the two heads. But when I then merge I get the message
merging test.txt
Unsupported file type .txt
merging test.txt failed!
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
I'm struggling to figure out what to do here ... The changes I made to the file do not conflict with each other.
Upvotes: 0
Views: 3782
Reputation: 628
Mercurial tries to use the merging-tool you have configured (see .hgrc) and this tool says: Unsupported file type .txt
and probably does nothing with the file. Therefore a diff does not show anything (your file remains unchanged, but the difference to the other branch actually exists. Perhaps you can see the diff using the revision numbers:
hg log -l 5
will show you the last 5 commits. Use the revisions to call hg diff -r $REV_FROM_AL -r $REV_FROM_BOB
To resolve you have to
text.txt
including what you want from the 2 versions (see diff above)hg resolve -m text.txt
I use a script written by Noel Burton-Krahn to manually merge in my preferred editor. On conflicting-errors the "simple version" of this script saves 3 files: original/parent, mine, other-version. See https://www.mercurial-scm.org/wiki/MergingManuallyInEditor
PS: sometimes working in different plattforms (Windows/Linux) I got empty diffs (on Windows) that I resolved doing a hg revert
on the file.
Upvotes: 0
Reputation: 78350
As @dalija-prasnikar suggests, there's a difference you're just not finding it. Try a hg diff
and see if anything's visible to you or post it in your question. Another possibility is file permission -- the execute bit is tracked and some filesystems swizzle those on you, and if the two branches disagree you might be asked to resolve it.
Upvotes: 0
Reputation: 28511
While you think that changes do not conflict with each other, Mercurial doesn't agree.
To reslove conflict you would have to open test.txt
file and manually resolve conflict in places where Mercurial has left conflict tags (<<<<<<< >>>>>>>), save corrected file and then run hg resolve
After merge is resolved you should commit changes with hg commit
You can find more details in Resolving conflicts in Mercurial
Upvotes: 1