I need to work togehter with multiple assistant developers on an Eclipse CDT project which is versioned with Mercurial. The Eclipse project settings such as build setting are defined in the .cproject
file.
When this file is tracked by Mercurial, developers need to constantly watch out when committing not to overwrite each others settings.
Of course this could be avoided by not adding the .cproject
file in the first place, but this is inconvenient, too:
Is there a convenient way to track and at the same time have user-specific versions of project files?
The standard approach is: Don't version .cproject
and friends. Add a folder templates
and put a sample copy of .cproject
there. New project members make a copy and customize to taste. This also allows you, as the author of the template, to have your own customizations that you don't share with everyone.
The limitation is that as you periodically change the default profile, changes don't get automatically propagated to everyone: You have to tell the other project members to apply them. But automatic propagation doesn't sound like a good idea in this case anyway.
You can use Mercurial Queues to manage your user specific patches. To share the patches MQ supports a patches repository.
The basic workflow to setup the patch and the patch repository is as follows :
cd repo
hg init --mq
echo a1 > a
hg commit -A -minit
hg qnew changing.a
echo a2 >> a
hg qrefresh
hg annotate a
> 0: a1
> 1: a2
hg -R $(hg root)/.hg/patches commit -m"my patches"
To setup a clone:
hg qclone file://$(pwd)/repo clone_repo
cd clone_repo
hg annotate a
> 0: a1
hg qpush -a
hg annotate a
> 0: a1
> 1: a2
You can also change the underlying changeset and reapply your patch:
hg qpop -a
echo a3 > a
hg commit -m"changing a"
hg qpush -a
hg annotate a
> 1: a3
> 2: a2
The easiest way to update the clone is to pull and update and to reapply the patches:
cd clone_repo
hg qpop -a
hg pull -u
hg qpush -a
hg annotate a
> 1: a3
> 2: a2
You can find a description of MQ in the Mercurial book , the Mercurial wiki and running hg help mq
for the latest documentation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.