Fossil SCM

First mostly-working version of the bundle proof-of-concept; trees can be exported and imported, although after import they don't hook up with their ancestors.

dg 2014-10-18 19:26 trunk
Commit f809eb4c1abd6af870d576976ba699acfbe6f55f
--- a/test/make-bundle-data.sh
+++ b/test/make-bundle-data.sh
@@ -0,0 +1,27 @@
1
+#!/bin/sh
2
+# This script creates the two repositories used by the bundle test tools.
3
+# Syntax: make-bundle-data.sh oldrepo.fossil newrepo.fossil
4
+# Warning! The two repositories will be *destroyed*!
5
+
6
+set -e -x
7
+
8
+oldrepo=$(readlink -f "$1")
9
+newrepo=$(readlink -f "$2")
10
+
11
+tmpdir=/tmp/$$.make-bundle-data
12
+
13
+rm -rf $oldrepo $newrepo $tmpdir
14
+fossil init $oldrepo
15
+mkdir $tmpdir
16
+(cd $tmpdir && fossil open $oldrepo && fossil settings -R $oldrepo autosync off)
17
+(cd $tmpdir && echo "empty" > 1 && fossil add 1 && fossil commit -m "Empty")
18
+(cd $tmpdir && echo "data" >> 1 && fossil commit -m "Add: data")
19
+(cd $tmpdir && echo "more data" >> 1 && fossil commit -m "Add: more data")
20
+
21
+fossil clone $oldrepo $newrepo
22
+rm -rf $tmpdir
23
+mkdir $tmpdir
24
+(cd $tmpdir && fossil open $newrepo && fossil settings -R $oldrepo autosync off)
25
+(cd $tmpdir && echo "even more data" >> 1 && fossil commit -m "Clone, add: even more data")
26
+(cd $tmpdir && echo "new file" > 2 && fossil add 2 && fossil commit -m "New file")
27
+
--- a/test/make-bundle-data.sh
+++ b/test/make-bundle-data.sh
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/test/make-bundle-data.sh
+++ b/test/make-bundle-data.sh
@@ -0,0 +1,27 @@
1 #!/bin/sh
2 # This script creates the two repositories used by the bundle test tools.
3 # Syntax: make-bundle-data.sh oldrepo.fossil newrepo.fossil
4 # Warning! The two repositories will be *destroyed*!
5
6 set -e -x
7
8 oldrepo=$(readlink -f "$1")
9 newrepo=$(readlink -f "$2")
10
11 tmpdir=/tmp/$$.make-bundle-data
12
13 rm -rf $oldrepo $newrepo $tmpdir
14 fossil init $oldrepo
15 mkdir $tmpdir
16 (cd $tmpdir && fossil open $oldrepo && fossil settings -R $oldrepo autosync off)
17 (cd $tmpdir && echo "empty" > 1 && fossil add 1 && fossil commit -m "Empty")
18 (cd $tmpdir && echo "data" >> 1 && fossil commit -m "Add: data")
19 (cd $tmpdir && echo "more data" >> 1 && fossil commit -m "Add: more data")
20
21 fossil clone $oldrepo $newrepo
22 rm -rf $tmpdir
23 mkdir $tmpdir
24 (cd $tmpdir && fossil open $newrepo && fossil settings -R $oldrepo autosync off)
25 (cd $tmpdir && echo "even more data" >> 1 && fossil commit -m "Clone, add: even more data")
26 (cd $tmpdir && echo "new file" > 2 && fossil add 2 && fossil commit -m "New file")
27
--- a/tools/exportbundle.sh
+++ b/tools/exportbundle.sh
@@ -0,0 +1,72 @@
1
+#!/bin/sh
2
+# This is a very, very prototype proof-of-concept tool to generate 'push
3
+# requests'. It diffs two repositories (currently only local ones) and
4
+# generates a bundle which contains all the artifacts needed to
5
+# reproduce a particular artifact.
6
+#
7
+# The intended workflow is: user says 'I want to make a bundle to update
8
+# OLD.fossil to checkin X of NEW.fossil'; the tool walks the checkin tree
9
+# of NEW.fossil to figure out what checkins are necessary to reproduce X;
10
+# then it removes all the checkins which are present in OLD.fossil; t --incremental the bundle.
11
+
12
+set -e
13
+
14
+oldrepo=$1
15
+newrepo=$2
16
+artifact=$3
17
+
18
+ridlist=ridlist
19
+
20
+fossil sqlite3 >$ridlist <<-EOF
21
+
22
+ATTACH DATABASE "$newrepo" AS new;
23
+ATTACH DATABASE "$oldrepo" AS old;
24
+
25
+-- Map of parent -> child checkin artifacts. This contains our checkin graph.
26
+
27
+CREATE TEMPORARY VIEW newcheckinmap AS
28
+ SELECT
29
+ child.uuid AS child,
30
+ child.rid AS rid,
31
+ parent.uuid AS parent,
32
+ parent.rid AS parentrid,
33
+ plink.mtime AS mtime
34
+ FROM
35
+ new.plink,
36
+ new.blob AS parent,
37
+ new.blob AS child
38
+ WHERE
39
+ (child.rid = plink.cid)
40
+ AND (parent.rid = plink.pid);
41
+
42
+CREATE TEMPORARY VIEW oldcheckinmap AS
43
+ SELECT
44
+ child.uuid AS child,
45
+ child.rid AS rid,
46
+ parent.uuid AS parent,
47
+ parent.rid AS parentrid,
48
+ plink.mtime AS mtime
49
+ FROM
50
+ old.plink,
51
+ old.blob AS parent,
52
+ old.blob AS child
53
+ WHERE
54
+ (child.rid = plink.cid)
55
+ AND (parent.rid = plink.pid);
56
+
57
+-- Create sets of all checkins (unordered). We construct these from the graph
58
+-- so we get only checkin artifacts.
59
+
60
+CREATE TEMPORARY parent AS id, parentrid AS rid #!/bin/sh
61
+# This is ototyp#!/bin/sh
62
+# This is a prototype #!/bin/sh
63
+# This ioall the ancest INNER JOINS old;
64
+
65
+-- Map of parent -> chilORDER BYf parent -> child cROM
66
+ new.plink,
67
+ The set of checkins and files for newrepo's artifact which *aren't* in oldrepocheckinsnotinnew AS
68
+ SELECT
69
+ desiredcheckins.id
70
+ FROM
71
+ desiredcheckins LEFT JOIN olol;ototype proof-of-concept#!/bin/sh
72
+# This is a very
--- a/tools/exportbundle.sh
+++ b/tools/exportbundle.sh
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/tools/exportbundle.sh
+++ b/tools/exportbundle.sh
@@ -0,0 +1,72 @@
1 #!/bin/sh
2 # This is a very, very prototype proof-of-concept tool to generate 'push
3 # requests'. It diffs two repositories (currently only local ones) and
4 # generates a bundle which contains all the artifacts needed to
5 # reproduce a particular artifact.
6 #
7 # The intended workflow is: user says 'I want to make a bundle to update
8 # OLD.fossil to checkin X of NEW.fossil'; the tool walks the checkin tree
9 # of NEW.fossil to figure out what checkins are necessary to reproduce X;
10 # then it removes all the checkins which are present in OLD.fossil; t --incremental the bundle.
11
12 set -e
13
14 oldrepo=$1
15 newrepo=$2
16 artifact=$3
17
18 ridlist=ridlist
19
20 fossil sqlite3 >$ridlist <<-EOF
21
22 ATTACH DATABASE "$newrepo" AS new;
23 ATTACH DATABASE "$oldrepo" AS old;
24
25 -- Map of parent -> child checkin artifacts. This contains our checkin graph.
26
27 CREATE TEMPORARY VIEW newcheckinmap AS
28 SELECT
29 child.uuid AS child,
30 child.rid AS rid,
31 parent.uuid AS parent,
32 parent.rid AS parentrid,
33 plink.mtime AS mtime
34 FROM
35 new.plink,
36 new.blob AS parent,
37 new.blob AS child
38 WHERE
39 (child.rid = plink.cid)
40 AND (parent.rid = plink.pid);
41
42 CREATE TEMPORARY VIEW oldcheckinmap AS
43 SELECT
44 child.uuid AS child,
45 child.rid AS rid,
46 parent.uuid AS parent,
47 parent.rid AS parentrid,
48 plink.mtime AS mtime
49 FROM
50 old.plink,
51 old.blob AS parent,
52 old.blob AS child
53 WHERE
54 (child.rid = plink.cid)
55 AND (parent.rid = plink.pid);
56
57 -- Create sets of all checkins (unordered). We construct these from the graph
58 -- so we get only checkin artifacts.
59
60 CREATE TEMPORARY parent AS id, parentrid AS rid #!/bin/sh
61 # This is ototyp#!/bin/sh
62 # This is a prototype #!/bin/sh
63 # This ioall the ancest INNER JOINS old;
64
65 -- Map of parent -> chilORDER BYf parent -> child cROM
66 new.plink,
67 The set of checkins and files for newrepo's artifact which *aren't* in oldrepocheckinsnotinnew AS
68 SELECT
69 desiredcheckins.id
70 FROM
71 desiredcheckins LEFT JOIN olol;ototype proof-of-concept#!/bin/sh
72 # This is a very
--- a/tools/importbundle.sh
+++ b/tools/importbundle.sh
@@ -0,0 +1,13 @@
1
+#!/bin/sh
2
+# Imports a bundle which has been exported with exportbundle.
3
+# Syntax: exportbundle.sh oldrepo.fossil newrepo.fossil data.bundle
4
+
5
+set -e
6
+
7
+oldrepo="$1"
8
+newrepo="$2"
9
+bundle="$3"
10
+
11
+fossil clone $oldrepo $newrepo
12
+fossil import --incremental $newrepo < $bundle
13
+
--- a/tools/importbundle.sh
+++ b/tools/importbundle.sh
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/tools/importbundle.sh
+++ b/tools/importbundle.sh
@@ -0,0 +1,13 @@
1 #!/bin/sh
2 # Imports a bundle which has been exported with exportbundle.
3 # Syntax: exportbundle.sh oldrepo.fossil newrepo.fossil data.bundle
4
5 set -e
6
7 oldrepo="$1"
8 newrepo="$2"
9 bundle="$3"
10
11 fossil clone $oldrepo $newrepo
12 fossil import --incremental $newrepo < $bundle
13

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button