You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Assaf Lavie <as...@gmail.com> on 2005/09/28 15:59:27 UTC

howto? specify non-mergability for a file

I have a text file under source control that keeps the build numbers
(auto-incremented every build).
The problem is this file is _always_ conflicted when more than one person
works on the project.
Can I mark this file as "always use newer version - never merge" somehow?

Thanks.

Re: howto? specify non-mergability for a file

Posted by Cory Omand <co...@blastwave.org>.
Assaf Lavie wrote:
> I have a text file under source control that keeps the build numbers 
> (auto-incremented every build).
> The problem is this file is _always_ conflicted when more than one 
> person works on the project.
> Can I mark this file as "always use newer version - never merge" somehow?

You could set svn:needs-lock on this file, which would prevent more than 
one person editing the file at a time:

$ svn propset svn:needs-lock true build.properties

... then, the file is normally read-only, until someone gets a lock on 
the file:

$ svn lock build.properties

... now the file is read/write for the current user -- commit it and 
unlock ...

$ svn commit -m "new build" build.properties
$ svn unlock build.properties

You need a recent version of Subversion to do this (1.2.x, 1.2.3 
recommended).  There is more information in the subversion book nightly 
build:

http://svnbook.red-bean.com/nightly/en/svn.advanced.locking.html

Regards,
Cory.



-- 
Cory Omand <co...@blastwave.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: howto? specify non-mergability for a file

Posted by Greg Thomas <th...@omc.bt.co.uk>.
On Fri, 30 Sep 2005 09:17:18 +0200, Unspammable
<un...@gmail.com> wrote:

>The build number indicates (roughly) how many times the project was built,
>and is somewhat useful as such.
>If it's not under source control the number would be a very poor indicator.

Surely it's a very poor indicator anyway. Even if you could take the
newest (timestamp) file (which you can't, BTW), it doesn't give an
indication of how many times the project was built.

1. User A checks out the project, revision = 1234, build number = 5.
2. User B checks out the project, revision = 1234, build number = 5.
3. User B builds the project, build number = 6.
...
9. User B builds the project, build number = 12.
10. User A builds the project, build number = 6

The 'User A' version of the file has the more recent timestamp, but in
fact the project has been built 8 additional times since it was
checked out, not the once the build number would indicate. 

>The file containing the build number must be
>updated before the build takes place. The revision number is updated when
>the file is commited, correct? 

Yes.

>This will create a discrepancy between the
>revision number and the version string attached to the executable.

Not necessarily. Either
(a) commit the file containing the revision before building the
executable, or
(b) use svnversion in your build scripts (see the FAQ) to populate
version string.

Greg
-- 
This post represents the views of the author and does
not necessarily accurately represent the views of BT.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: howto? specify non-mergability for a file

Posted by Unspammable <un...@gmail.com>.
On 9/29/05, Greg Thomas <th...@omc.bt.co.uk> wrote:
>
> On Wed, 28 Sep 2005 18:59:27 +0300, Assaf Lavie <as...@gmail.com>
> wrote:
>
> >Can I mark this file as "always use newer version - never merge" somehow?
>
> Define "newer". Do you mean timestamp, or as I suspect, "the version
> of the file which has the largest build number in it". If the latter,
> you may get an idea of the complexity of the problem.


Yes, you assumed correctly. However, I'm willing to settle for the former
(timestamp).
How would I go about telling SVN to always prefer the latest file?

To answer your question - you can't. Perhaps this file shouldn't be
> version controlled at all


The build number indicates (roughly) how many times the project was built,
and is somewhat useful as such.
If it's not under source control the number would be a very poor indicator.

- can you use the subversion revision number
> (see http://subversion.tigris.org/faq.html#version-value-in-source)
> instead?


I'm not sure. I doubt it. The file containing the build number must be
updated before the build takes place. The revision number is updated when
the file is commited, correct? This will create a discrepancy between the
revision number and the version string attached to the executable.

[snip]

Re: howto? specify non-mergability for a file

Posted by Greg Thomas <th...@omc.bt.co.uk>.
On Wed, 28 Sep 2005 18:59:27 +0300, Assaf Lavie <as...@gmail.com>
wrote:

>Can I mark this file as "always use newer version - never merge" somehow?

Define "newer". Do you mean timestamp, or as I suspect, "the version
of the file which has the largest build number in it". If the latter,
you may get an idea of the complexity of the problem.

To answer your question - you can't. Perhaps this file shouldn't be
version controlled at all - can you use the subversion revision number
(see http://subversion.tigris.org/faq.html#version-value-in-source)
instead?

Greg
-- 
This post represents the views of the author and does
not necessarily accurately represent the views of BT.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org