You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Russ Brown <pi...@gmail.com> on 2005/06/15 15:23:27 UTC

Detecting merges

Hello,

Is there any way (other than depending on developers providing
parsable commit logs) of detecting at the hook stage whether a given
commit contains a merge or not?

What I want to be able to do is set a revision property automatically
in such cases, which I intend to use in other scripts for helping to
calculate required merges (among other things).

-- 

Russ

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


Re: Detecting merges

Posted by Ben Collins-Sussman <su...@collab.net>.
On Jun 15, 2005, at 10:23 AM, Russ Brown wrote:

> Hello,
>
> Is there any way (other than depending on developers providing
> parsable commit logs) of detecting at the hook stage whether a given
> commit contains a merge or not?
>

Nope, there's no merge tracking.  After running 'svn merge', the  
client has no idea where the edits in your working copy came from.   
It doesn't know whether they're the result of a merge command, or  
whether you hand-edited everything yourself.  So when the server  
receives those edits, it's still impossible to know where the changes  
came from.


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

Re: Detecting merges

Posted by Kevin Puetz <pu...@puetzk.org>.
There is also the script svnmerge at
http://svn.collab.net/viewcvs/svn/trunk/contrib/client-side/svnmerge, which
uses folder properties to store what has and hasn't been merged yet.

Kyle Kline wrote:

> SVK (http://svk.elixus.org/) does this almost exactly with its star-merge
> feature (svk smerge). SVK is command-line only though.



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

Re: Detecting merges

Posted by Kyle Kline <ky...@gmail.com>.
SVK (http://svk.elixus.org/) does this almost exactly with its star-merge 
feature (svk smerge). SVK is command-line only though.

On 6/16/05, Scott Palmer <sc...@2connected.org> wrote:
> 
> 
> On Jun 15, 2005, at 7:02 PM, Russ Brown wrote:
> 
> > Olivier Sannier wrote:
> >
> >> Russ Brown wrote:
> >>
> >>> Hello,
> >>>
> >>> Is there any way (other than depending on developers providing
> >>> parsable commit logs) of detecting at the hook stage whether a given
> >>> commit contains a merge or not?
> >>>
> >>> What I want to be able to do is set a revision property
> >>> automatically
> >>> in such cases, which I intend to use in other scripts for helping to
> >>> calculate required merges (among other things).
> 
> 
> > As Ben has already pointed out, that's simply not currently
> > possible, which is a shame. In that case, the only solutions I can
> > think of are for a hook script to detect the merge from the commit
> > comment, or by the user explicitly declaring a commit by some
> > interface; both of which are prone to the user forgetting.
> >
> > ...how hard would it be to make Subversion set a boolean revprop on
> > revisions that contain 'a merge of some sort'? From what I can
> > figure, that would require the 'merge' command leaving some sort of
> > trace for 'commit' to pick up and apply to the revision. That trace
> > would clearly need to be 'reverted' once all merged-files had been
> > reverted.
> 
> 
> You could write a wrapper script for the svn command that deferred to
> the regular svn command for all but "merge" (and it's synonyms).. if
> the command completed successfully it could make a revprop in the WC
> that contained details about the merge command.
> 
> Handling a subsequent "revert" before the "commit" could get very
> tricky though.
> 
> Scott
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 
>

Re: Detecting merges

Posted by Scott Palmer <sc...@2connected.org>.
On Jun 15, 2005, at 7:02 PM, Russ Brown wrote:

> Olivier Sannier wrote:
>
>> Russ Brown wrote:
>>
>>> Hello,
>>>
>>> Is there any way (other than depending on developers providing
>>> parsable commit logs) of detecting at the hook stage whether a given
>>> commit contains a merge or not?
>>>
>>> What I want to be able to do is set a revision property  
>>> automatically
>>> in such cases, which I intend to use in other scripts for helping to
>>> calculate required merges (among other things).


> As Ben has already pointed out, that's simply not currently  
> possible, which is a shame. In that case, the only solutions I can  
> think of are for a hook script to detect the merge from the commit  
> comment, or by the user explicitly declaring a commit by some  
> interface;  both of which are prone to the user forgetting.
>
> ...how hard would it be to make Subversion set a boolean revprop on  
> revisions that contain 'a merge of some sort'? From what I can  
> figure, that would require the 'merge' command leaving some sort of  
> trace for 'commit' to pick up and apply to the revision. That trace  
> would clearly need to be 'reverted' once all merged-files had been  
> reverted.


You could write a wrapper script for the svn command that deferred to  
the regular svn command for all but "merge" (and it's synonyms).. if  
the command completed successfully it could make a revprop in the WC  
that contained details about the merge command.

Handling a subsequent "revert" before the "commit" could get very  
tricky though.

Scott


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

Re: Detecting merges

Posted by Russ Brown <pi...@gmail.com>.
Olivier Sannier wrote:
> Russ Brown wrote:
> 
>> Hello,
>>
>> Is there any way (other than depending on developers providing
>> parsable commit logs) of detecting at the hook stage whether a given
>> commit contains a merge or not?
>>
>> What I want to be able to do is set a revision property automatically
>> in such cases, which I intend to use in other scripts for helping to
>> calculate required merges (among other things).
>>
> Maybe I'm being stupid here, but don't all commits contain a merge?
> I mean, if I commit something, it's a change to the file, hence, a merge 
> is required to get this change.
> Or maybe you have another meaning for the word "merge" which I'm not 
> getting here.
> 

That is technically true, in that any commit consists of the original 
files merged with changes from the working copy. However, what I'm 
specifically talking about is a commit that consists of the original 
files in the working copy merged with changes brought about by 
subversion's 'merge' command. i.e, a merge from branch to trunk, or 
merge from trunk to branch etc.

As Ben has already pointed out, that's simply not currently possible, 
which is a shame. In that case, the only solutions I can think of are 
for a hook script to detect the merge from the commit comment, or by the 
user explicitly declaring a commit by some interface;  both of which are 
prone to the user forgetting.

I fully understand the complexities in the 'full merge tracking' 
problem. That being the case, how hard would it be to make Subversion 
set a boolean revprop on revisions that contain 'a merge of some sort'? 
 From what I can figure, that would require the 'merge' command leaving 
some sort of trace for 'commit' to pick up and apply to the revision. 
That trace would clearly need to be 'reverted' once all merged-files had 
been reverted.

I realise that wouldn't be a proper merge tracking feature, but it would 
be immediately useful in a number of situations right now.

Thanks.

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


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

Re: Detecting merges

Posted by Olivier Sannier <ob...@free.fr>.
Russ Brown wrote:

>Hello,
>
>Is there any way (other than depending on developers providing
>parsable commit logs) of detecting at the hook stage whether a given
>commit contains a merge or not?
>
>What I want to be able to do is set a revision property automatically
>in such cases, which I intend to use in other scripts for helping to
>calculate required merges (among other things).
>
Maybe I'm being stupid here, but don't all commits contain a merge?
I mean, if I commit something, it's a change to the file, hence, a merge 
is required to get this change.
Or maybe you have another meaning for the word "merge" which I'm not 
getting here.

Cheers
Olivier

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