Using Mercurial for other kinds of ASCII files than codes?

Tom Anderson tom.anderson at timgroup.com
Mon Oct 22 09:46:55 UTC 2012


On 20/10/12 13:43, Pierre JUILLARD wrote:
> Another limitation would be the application of the "diff" tool:
> When modifying a part (new revision):
> - the STEP file will not be modified manually,
> - it will be open in a CAD program, the part will be modified, and the 
> STEP file will be re-written
> This means that the order of the sections in the STEP file may change.

That could be a problem. Mercurial will be able to cope with this, no 
problem, but you may end up with painful merges. Consider this scenario:

1. file A contains:
section 1
section 2
section 3

2. Alice clones the central repository, opens A, and edits section 1; 
the CAD tool produces:
section 1a
section 2
section 3

3. Alice clones the central repository, opens A, and edits section 1; 
the CAD tool produces:
section 2
section 3
section 1b

4. Alice pushes to the central repository

5. Bob pulls from the central repository and merges; he gets a 
conflicted file which looks like:
section 1a - conflict between Alice's change and Bob's pseudo-deletion
section 2
section 3
section 1b - clean addition

That's a pain. There is a real conflict, between 1a and 1b, but 
Mercurial can't see it, because 1a and 1b are in different places in the 
file.

What would be good is if there was a tool that would normalise a file so 
that the sections are in some consistent order. Then, you simply 
normalise each file before committing it, probably using a hook. That 
would ensure that conflicts are detected properly. Does such a tool 
exist? Could you write one?

This would be a bit like auto-formatting source code before committing 
it, to avoid spurious merge conflicts caused by whitespace changes etc. 
That's also something i highly recommend doing - as long as you can 
ensure everyone on the team has the same formatting rules!

tom

-- 

Tom Anderson | Developer | +44 20 7826 4312 | timgroup.com 
<http://timgroup.com/>

STATEMENT OF CONFIDENTIALITY: The information contained in this 
electronic message and any attachments to this message are intended for 
the exclusive use of the addressee(s) and may contain confidential or 
privileged information. If you are not the intended recipient, please 
notify Tom Anderson at TIM Group at tom.anderson at timgroup.com and 
destroy all copies of this message and any attachments.

TIM Group is the trading name for YouDevise Limited. YouDevise Limited 
is registered in England, No. 3331176. Registered office: 3 Copthall 
Avenue, London, EC2R 7BH.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20121022/b2580dac/attachment-0002.html>


More information about the Mercurial mailing list