« Return to Thread: setting revision range when merging related branches

Re: setting revision range when merging related branches

by Alexander Sinyushkin-2 :: Rate this Message:

Reply to Author | View in Thread

Hello Scott,

In a next version of SVNKit the start point will be found automatically
for your case. But for older releases I see no other way as finding the
copy creation point manually. Given a repository root url and changed
paths you can create a url for a changed path this way:

SVNURL reposRootURL = ...;
SVNURL mergeSourceURL = ...;
SVNURL mergeTargetURL = ...;
SVNURL changedPathURL = null;
long startRev = 1;
...
   String changedPath = (String) changedPathsIter.next();
   SVNLogEntryPath logEntryPath = (SVNLogEntryPath)
changedPaths.get(changedPath);
   changedPathURL = reposRootURL.appendPath(changedPath, false);
   if (changedPathURL.equals(mergeTargetURL) && logEntryPath.getType()
== SVNLogEntryPath.TYPE_ADDED && logEntryPath.getCopyPath() != null) {
       SVNURL copyFromURL =
reposRootURL.appendPath(logEntryPath.getCopyPath(), false);
       if (copyFromURL.equals(mergeSourceURL)) {
           startRev = logEntryPath.getCopyRevision();
           break;
       }
   }


If I have understood your task correctly I think you need that
copy-from-revision, that is that very revision from which the child
branch was created, but not the revision in which it was created,
because they may be different.

----
Alexander Sinyushkin,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!

Scott Carter wrote:

> Hello –
>
>  
>
> I have a merging question when branches are releated.  In most cases
> when we merge 2 branches I set the revision range to be merged of the
> source branch from its first revision to the latest.  This does not make
> sense when merging to a branch which is the child of the source branch.  
> In this case you would want to start your revision range from the
> revision where the child branch was created.  There would not be any
> point in applying source revisions to a target from a point in time
> where the 2 branches were the same code line.
>
>  
>
> My thought on how to do this was to take the history of the target
> branch and trace back (stop on copy set to false) and trace back to see
> if the target has the same URL as the parent source at some point.  This
> would then be the starting point for the revision range of the merge.  
> The problem here is this is not that straight forward, the history for
> the target contains a Map of changed paths.  It is not that simple to
> get back to URLs to compare to the URL of the source branch.  In going
> down this path I am thinking there must be an easier way to do this.
>
>  
>
> So the question is what is the correct way to set the revision range for
> a merge where the target of the merge is a child branch of the source
> for the merge?
>
>  
>
> Thanks in advance for the help.
>
>  
>
> Scott A Carter
>
> Software Configuration Management Engineer
>
> Conexant E-mail Firewall (Conexant.Com) made the following annotations
> ---------------------------------------------------------------------
> ********************** Legal Disclaimer ****************************
>
> "This email may contain confidential and privileged material for the
> sole use of the intended recipient. Any unauthorized review, use or
> distribution by others is strictly prohibited. If you have received the
> message in error, please advise the sender by reply email and delete the
> message. Thank you."
>
> **********************************************************************
> ---------------------------------------------------------------------
>

---------------------------------------------------------------------
To unsubscribe, e-mail: svnkit-users-unsubscribe@...
For additional commands, e-mail: svnkit-users-help@...

 « Return to Thread: setting revision range when merging related branches

LightInTheBox - Buy quality products at wholesale price