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

Answering "in which revision was this branch created?"

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Mon, 02 Nov 2009 11:32:20 +0000

A "quick win" enhancement?

REQUIREMENT

A user or admin at SubConf told me he often wanted to know when a branch
had been created. We have:

  svn log -q --stop-on-copy

which gives the correct answer, but on a long-lived branch this can take
a long time - minutes - to complete, which is frustrating and makes the
question practically unavailable to most scripts. It is with heavy use
of branching that this question becomes commonly asked.

I have to admit I don't know this particular user's use case - context -
of wanting to know the branch point. I do know there are several things
it is helpful for.

ANALYSIS

If Subversion had a primary concept of "a branch", we would want to know
when "this branch" was created:

  (1) In which revision was the branch 'B' created?

As Subversion's concept of a branch is a node that has been copied, we
can ask the question as:

  (2) In which revision was the branch root directory 'B' most recently
created by copying?

When we support True Renames, we will want to ignore any moves or
renames of the branch since it was created. Until then, we could
implement this question instead:

  (3) In which revision did this node's line of history last come to its
current (repository) path? In other words, in which revision was this
node most recently added or copied (to here) or moved (to here)?

Now that we are thinking about a question that applies to any node, not
necessarily a branch, we might sometimes want to ask a variant of that
question. Imagine a file BAR that has been copied from file FOO at some
time, but we don't know whether that was before or after the branch B
was created. We could ask:

  (4) In which revision was B/BAR most recently added or copied (to
here) or moved (to here), ignoring any branching (copying) of its parent
directories?

But I think question (4) fits less well with Subversion's concepts than
(3).

UI DESIGN (COMMAND-LINE)

Eventually we might have a set of branching commands, and then the
branch-aware version of this query should fit in with them. Until then,
I don't want to see a new subcommand like

  svn in-which-revision-was-this-branch-created

but we need to look for a UI space for this (and several other queries
that 'svn' ought to support).

It feels to me that the query version (3) fits well in the "svn info"
output. In the example below (which is on a file rather than a branch),
the last line of "svn info" output is new:

[[[
$ svn log -vq --stop-on-copy ~/public_html/upload.sh
------------------------------------------------------------------------
r5 | julianfoad | 2009-06-26 17:28:30 +0100 (Fri, 26 Jun 2009)
Changed paths:
   D /public_html/rsync-this.sh
   A /public_html/upload.sh (from /public_html/rsync-this.sh:2)
------------------------------------------------------------------------

$ svn info ~/public_html/upload.sh
Path: /home/julianfoad/public_html/upload.sh
Name: upload.sh
URL: file:///home/julianfoad/vcs/green/public_html/upload.sh
Repository Root: file:///home/julianfoad/vcs/green
Repository UUID: 0e873508-286d-0410-b431-0fc449f9f81d
Revision: 5
Node Kind: file
Schedule: normal
Last Changed Author: julianfoad
Last Changed Rev: 5
Last Changed Date: 2009-06-26 17:28:30 +0100 (Fri, 26 Jun 2009)
Text Last Updated: 2009-06-25 11:45:23 +0100 (Thu, 25 Jun 2009)
Checksum: 55d960df51a56fd911784159c7657559
At This Repos Path Since Revision: 5
]]]

or "Came Here In Revision: 5"?

Thoughts?

- Julian

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2413786
Received on 2009-11-02 14:56:03 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.