SVNKIT doExport method - what is pegRevision?
Asked Answered
O

2

5

When using the doExport() method of svnkit I don't understand the meaning of one parameter.

I still don't get it even after looking at the Javadocs

What does the parameter pegRevision mean?

The docs say

pegRevision - the revision at which url will be firstly seen in the repository to make sure it's the one that is needed

but that doesnt really help me understand it.

Outofdoors answered 14/7, 2011 at 15:20 Comment(0)
D
5

Have a look at this great explanation. As taken from the javadoc you mentioned:

... the revision at which the url will be firstly seen in the repository to make sure it's the one that is needed ...

I believe this is normally @BASE or @HEAD. This is a revision provided to Subversion for the sole purpose of identifying a unique line of history. Because at most one versioned resource may occupy a path at any given time — or, more precisely, in any one revision—the combination of a path and a peg revision is all that is needed to refer to a specific line of history.

Try using HEAD:

org.tmatesoft.svn.core.wc.Revision.HEAD

Denton answered 14/7, 2011 at 15:43 Comment(0)
D
2

example:

Say that long ago we created our repository, and in revision 1 we added our first concept directory, plus an IDEA file in that directory talking about the concept. After several revisions in which real code was added and tweaked, we, in revision 20, renamed this directory to frabnaggilywort. By revision 27, we had a new concept, a new concept directory to hold it, and a new IDEA file to describe it. And then five years and thousands of revisions flew by, just like they would in any good romance story.

Now, years later, we wonder what the IDEA file looked like back in revision 1. But Subversion needs to know whether we are asking about how the current file looked back in revision 1, or whether we are asking for the contents of whatever file lived at concepts/IDEA in revision 1. Certainly those questions have different answers, and because of peg revisions, you can ask those questions. To find out how the current IDEA file looked in that old revision, you run:

$ svn cat -r 1 concept/IDEA 
svn: Unable to find repository location for 'concept/IDEA' in revision 1

Of course, in this example, the current IDEA file didn't exist yet in revision 1, so Subversion gives an error.

The mechanism called peg revision can solve the problem ;

$ svn cat -r 1 concept/IDEA@BASE
or
$ svn cat -r 1 concept/IDEA@1

-------------------------- more complex situations-----------------------------------

say frabnaggilywort had been deleted from HEAD, but we have knew it existed in revision 20( by seeing svn logs ), and we want to see the diffs for its IDEA file between revisions 4 and 10. We can use peg revision 20 in conjunction with the URL that would have held Frabnaggilywort's IDEA file in revision 20, and then use 4 and 10 as our operative revision range.

$ svn diff -r 4:10 http://svn.red-bean.com/projects/frabnaggilywort/IDEA@20
Index: frabnaggilywort/IDEA
===================================================================
--- frabnaggilywort/IDEA    (revision 4)
+++ frabnaggilywort/IDEA    (revision 10)
@@ -1,5 +1,5 @@
-The idea behind this project is to come up with a piece of software
+The idea behind this project is to come up with a piece of

more in here http://svnbook.red-bean.com/en/1.6/svn.advanced.pegrevs.html

Deep answered 20/4, 2013 at 17:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.