[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Repo API -- finding the "last revision" of a file

From: Stephen Butler <sbutler_at_elego.de>
Date: Mon, 21 Jan 2008 18:52:30 +0100

Hi folks, especially the repository experts,

On the tree-conflicts branch, we'd like to use the repository history
to rule out some false positives during merge. It's not clear (to us)
how to ask the repo certain questions, such as "Did file Foo.c ever
exist in the current branch, and if so, which revision was the last one
to include Foo.c?".

Suppose Foo.c is to be edited by a merge, but Foo.c does not exist in
the BASE revision of the current working copy. Use case 4 in
notes/tree-conflicts/detection.txt says we should mark this as a tree
conflict if all of the following are true.

   1. The files at path Foo.c in merge-left and and in merge-right have
      a common ancestor.

   2. A file Foo.c used to exist in the branch the working copy was
      checked out from.

   3. The "last surviving" Foo.c in the working copy's branch has an ancestor
      in common with the Foo.c in the branch that is the source of the

To make the example more concrete, suppose the user executed the
following command to merge some changes from their trunk to a working
copy of branches/mybranch. Foo.c has been modified on trunk, and it does
not exist in the BASE revision of the working copy of branches/mybranch.

   $ svn merge -r20:25 $trunk_url $mybranch_wc

We have a tree conflict if the following are true:

   1. $trunk_url/Foo.c_at_20 and $trunk_url/Foo.c_at_25 have a youngest common
      ancestor revision YCA1 (most likely r20).

   2. There is a "last revision" of Foo.c in $mybranch_url (e.g., if r16
      deletes $mybranch_url/Foo.c, then the last revision would be r15).

   3. YCA1 and the last revision of $mybranch_url/Foo.c have a
      youngest common ancestor YCA2.

Our question is, how to we find the last revision at which Foo.c
existed in branches/mybranch? Can we simply call
svn_client__repos_location_segments() with the following args?

    path: "Foo.c"
    peg_revision: SVN_INVALID_REVNUM
    start_rev: BASE


Stephen Butler | Software Developer
elego Software Solutions GmbH
Gustav-Meyer-Allee 25 | 13355 Berlin | Germany
fon: +49 30 2345 8696 | mobile: +49 163 25 45 015
fax: +49 30 2345 8695 | http://www.elegosoft.com
Geschäftsführer: Olaf Wagner | Sitz der Gesellschaft: Berlin
Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-01-21 19:12:56 CET

This is an archived mail posted to the Subversion Dev mailing list.