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

some questions on how exactly SVN works when restoring an old file version

From: Bo Chen <bo.irvine.chen_at_gmail.com>
Date: Fri, 15 Feb 2013 12:20:52 -0500

Hi, can anyone help me a little bit for these questions: How does SVN work
when recovering to a desired copy, specifically, how EXACTLY SVN does by
combining the delta to reconstruct a desired file version.In CVS, they
record the delta (for text file), as well as the update information like in
which lines we have an insertion/deletion. However, in SVN, do we keep this
information? Otherwise, how can we restore a desired file version. For
example, I create one file, and make one simple insertion (insert a
character). The following shows the file versions and the corresponding
delta information in the repository. Can anyone tell me how exactly can I
restore the second file version by the fist file version and the delta file
for the second file version? I appreciate very much for your help.

Bo

*The first version:*

#include "stdio.h"
#include "stdlib.h"
#include "unistd.h"
#include "aa.h"
#include "bb.h"
#include "cc.h"
#include "ee.h"
#include "ff.h"
int main(int argc, char **argv)
{
        while(1)
        {
                        printf("test");
                        sleep(2);
}
}

*After one simple insertion (the second version):*

#include "stdio.h"
#include "stdlib.h"
#include "unistd.h"
#include "aa.h"
#include "bb.h"
#include "cc.h"
#include "ee.h"
#include "ff.h"
int main(int argc, char **argv)
{
        while(1*2*)
        {
                        printf("test");
                        sleep(2);
}
}

The corresponding data in the SVN repository.

*db/revs/1:*

DELTA
SVN^A^@^@<81>^^D<81>`^C<80><81>^<81>^#include "stdio.h"
#include "stdlib.h"
#include "unistd.h"
#include "aa.h"
#include "bb.h"
#include "cc.h"
#include "ee.h"
#include "ff.h"
int main(int argc, char **argv)
{
while(1)
{
printf("test");
sleep(2);
}
}
ENDREP
id: 0-1.0.r1/252
type: file
count: 0
text: 1 0 239 222 166c28169fe55ecdb604a164e3065e74
b3a2ca012a5c65f2d9cc3f4a99454c4ca075b5e3 0-0/_2
cpath: /test
copyroot: 0 /

PLAIN
K 4
test
V 17
file 0-1.0.r1/252
END
ENDREP
id: 0.0.r1/465
type: dir
pred: 0.0.r0/17
count: 1
text: 1 416 36 36 d4e9b29f24f81064aa79a843f4e5593a
cpath: /
copyroot: 0 /

_0.0.t0-0 add-file true false /test

465 590

*db/revs/2:*
*
*DELTA 1 0 239
SVN^A^@<81>^<81>_^F+^E^@<81>5^@ª*2)
        {
                        printf("test");
                        sleep(2);
}
}
ENDREP
id: 0-1.0.r2/81
type: file
pred: 0-1.0.r1/252
count: 1
text: 2 0 60 223 dd5c3d6265a059337999340e977ae639
e2e7fb80494249c03a6b96ea3decf1
92d4ec43b9 1-1/_1
cpath: /test
copyroot: 0 /

PLAIN
K 4
test
V 16
file 0-1.0.r2/81
END
ENDREP
id: 0.0.r2/310
type: dir
pred: 0.0.r1/465
count: 2
text: 2 262 35 35 a94dd277d2fd322f5c78ebe82ddca4ac
cpath: /
copyroot: 0 /

0-1.0.t1-1 modify-file true false /test

310 436
Received on 2013-02-15 18:21:28 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.