Fossil SCM

More simplification; now correctly handles branches in newrepo (i.e. only the desired branch is exported).

dg 2014-10-18 22:13 dtrg-bundles
Commit 22048c41dc6b7d565d674c91ab8f173892610be5
--- test/make-bundle-data.sh
+++ test/make-bundle-data.sh
@@ -21,7 +21,10 @@
2121
fossil clone $oldrepo $newrepo
2222
rm -rf $tmpdir
2323
mkdir $tmpdir
2424
(cd $tmpdir && fossil open $newrepo && fossil settings -R $oldrepo autosync off)
2525
(cd $tmpdir && echo "even more data" >> 1 && fossil commit -m "Clone, add: even more data")
26
+(cd $tmpdir && fossil tag add branchpoint tip)
2627
(cd $tmpdir && echo "new file" > 2 && fossil add 2 && fossil commit -m "New file")
28
+(cd $tmpdir && fossil update branchpoint)
29
+(cd $tmpdir && echo "branched data" >> 1 && fossil commit -b branch -m "Branch, add: branched data")
2730
2831
--- test/make-bundle-data.sh
+++ test/make-bundle-data.sh
@@ -21,7 +21,10 @@
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
28
--- test/make-bundle-data.sh
+++ test/make-bundle-data.sh
@@ -21,7 +21,10 @@
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 && fossil tag add branchpoint tip)
27 (cd $tmpdir && echo "new file" > 2 && fossil add 2 && fossil commit -m "New file")
28 (cd $tmpdir && fossil update branchpoint)
29 (cd $tmpdir && echo "branched data" >> 1 && fossil commit -b branch -m "Branch, add: branched data")
30
31
--- tools/exportbundle.sh
+++ tools/exportbundle.sh
@@ -56,22 +56,33 @@
5656
old.blob AS child
5757
WHERE
5858
(child.rid = plink.cid)
5959
AND (parent.rid = plink.pid);
6060
--- Create sets of all checkins (unordered). We construct these from the graph
--- so we get only checkin artifacts.
61
+-- Create sets of all checkins.
6162
6263
CREATE TEMPORARY VIEW newcheckins AS
63
- SELECT parent AS id, parentrid AS rid FROM newcheckinmap
64
- UNION
65
- SELECT child AS id, rid AS rid FROM newcheckinmap;
64
+ SELECT
65
+ blob.uuid AS id,
66
+ blob.rid AS rid
67
+ FROM
68
+ new.blob, new.event
69
+ ON
70
+ blob.rid = event.objid
71
+ WHERE
72
+ event.type = "ci";
6673
6774
CREATE TEMPORARY VIEW oldcheckins AS
68
- SELECT parent AS id, parentrid AS rid FROM oldcheckinmap
69
- UNION
70
- SELECT child AS id, rid AS rid FROM oldcheckinmap;
75
+ SELECT
76
+ blob.uuid AS id,
77
+ blob.rid AS rid
78
+ FROM
79
+ old.blob, old.event
80
+ ON
81
+ blob.rid = event.objid
82
+ WHERE
83
+ event.type = "ci";
7184
7285
-- Now create maps of checkin->file artifacts.
7386
7487
CREATE TEMPORARY VIEW newfiles AS
7588
SELECT
@@ -101,11 +112,11 @@
101112
FROM
102113
newcheckinmap, ancestors
103114
ON
104115
newcheckinmap.child = ancestors.id
105116
WHERE
106
- -- Filter to include checkins which *aren't* in oldrepo.
117
+ -- Filter to only include checkins which *aren't* in oldrepo.
107118
NOT EXISTS(SELECT * FROM oldcheckinmap WHERE
108119
oldcheckinmap.child = newcheckinmap.parent)
109120
ORDER BY
110121
newcheckinmap.mtime DESC
111122
)
@@ -128,17 +139,17 @@
128139
-- ignore, we have to emit a list of all rids in newrepo which don't correspond
129140
-- to the list above.
130141
131142
CREATE TEMPORARY VIEW skipcheckinrids AS
132143
SELECT
133
- "c" || oldcheckins.rid AS msg,
134
- oldcheckins.rid AS rid,
135
- oldcheckins.id AS id
144
+ "c" || newcheckins.rid AS msg,
145
+ newcheckins.rid AS rid,
146
+ newcheckins.id AS id
136147
FROM
137
- oldcheckins LEFT JOIN desiredcheckins
148
+ newcheckins LEFT JOIN desiredcheckins
138149
ON
139
- desiredcheckins.id = oldcheckins.id
150
+ desiredcheckins.id = newcheckins.id
140151
WHERE
141152
desiredcheckins.id IS NULL
142153
ORDER BY
143154
rid ASC;
144155
@@ -158,7 +169,8 @@
158169
UNION
159170
SELECT msg FROM skipcheckinrids;
160171
161172
EOF
162173
174
+#cat $ridlist
163175
fossil export --git --import-marks $ridlist $newrepo
164176
165177
--- tools/exportbundle.sh
+++ tools/exportbundle.sh
@@ -56,22 +56,33 @@
56 old.blob AS child
57 WHERE
58 (child.rid = plink.cid)
59 AND (parent.rid = plink.pid);
60
--- Create sets of all checkins (unordered). We construct these from the graph
--- so we get only checkin artifacts.
 
61
62 CREATE TEMPORARY VIEW newcheckins AS
63 SELECT parent AS id, parentrid AS rid FROM newcheckinmap
64 UNION
65 SELECT child AS id, rid AS rid FROM newcheckinmap;
 
 
 
 
 
 
66
67 CREATE TEMPORARY VIEW oldcheckins AS
68 SELECT parent AS id, parentrid AS rid FROM oldcheckinmap
69 UNION
70 SELECT child AS id, rid AS rid FROM oldcheckinmap;
 
 
 
 
 
 
71
72 -- Now create maps of checkin->file artifacts.
73
74 CREATE TEMPORARY VIEW newfiles AS
75 SELECT
@@ -101,11 +112,11 @@
101 FROM
102 newcheckinmap, ancestors
103 ON
104 newcheckinmap.child = ancestors.id
105 WHERE
106 -- Filter to include checkins which *aren't* in oldrepo.
107 NOT EXISTS(SELECT * FROM oldcheckinmap WHERE
108 oldcheckinmap.child = newcheckinmap.parent)
109 ORDER BY
110 newcheckinmap.mtime DESC
111 )
@@ -128,17 +139,17 @@
128 -- ignore, we have to emit a list of all rids in newrepo which don't correspond
129 -- to the list above.
130
131 CREATE TEMPORARY VIEW skipcheckinrids AS
132 SELECT
133 "c" || oldcheckins.rid AS msg,
134 oldcheckins.rid AS rid,
135 oldcheckins.id AS id
136 FROM
137 oldcheckins LEFT JOIN desiredcheckins
138 ON
139 desiredcheckins.id = oldcheckins.id
140 WHERE
141 desiredcheckins.id IS NULL
142 ORDER BY
143 rid ASC;
144
@@ -158,7 +169,8 @@
158 UNION
159 SELECT msg FROM skipcheckinrids;
160
161 EOF
162
 
163 fossil export --git --import-marks $ridlist $newrepo
164
165
--- tools/exportbundle.sh
+++ tools/exportbundle.sh
@@ -56,22 +56,33 @@
56 old.blob AS child
57 WHERE
58 (child.rid = plink.cid)
59 AND (parent.rid = plink.pid);
60
--- Create sets of all checkins (unordered). We construct these from the graph
--- so we get only checkin artifacts.
61 -- Create sets of all checkins.
62
63 CREATE TEMPORARY VIEW newcheckins AS
64 SELECT
65 blob.uuid AS id,
66 blob.rid AS rid
67 FROM
68 new.blob, new.event
69 ON
70 blob.rid = event.objid
71 WHERE
72 event.type = "ci";
73
74 CREATE TEMPORARY VIEW oldcheckins AS
75 SELECT
76 blob.uuid AS id,
77 blob.rid AS rid
78 FROM
79 old.blob, old.event
80 ON
81 blob.rid = event.objid
82 WHERE
83 event.type = "ci";
84
85 -- Now create maps of checkin->file artifacts.
86
87 CREATE TEMPORARY VIEW newfiles AS
88 SELECT
@@ -101,11 +112,11 @@
112 FROM
113 newcheckinmap, ancestors
114 ON
115 newcheckinmap.child = ancestors.id
116 WHERE
117 -- Filter to only include checkins which *aren't* in oldrepo.
118 NOT EXISTS(SELECT * FROM oldcheckinmap WHERE
119 oldcheckinmap.child = newcheckinmap.parent)
120 ORDER BY
121 newcheckinmap.mtime DESC
122 )
@@ -128,17 +139,17 @@
139 -- ignore, we have to emit a list of all rids in newrepo which don't correspond
140 -- to the list above.
141
142 CREATE TEMPORARY VIEW skipcheckinrids AS
143 SELECT
144 "c" || newcheckins.rid AS msg,
145 newcheckins.rid AS rid,
146 newcheckins.id AS id
147 FROM
148 newcheckins LEFT JOIN desiredcheckins
149 ON
150 desiredcheckins.id = newcheckins.id
151 WHERE
152 desiredcheckins.id IS NULL
153 ORDER BY
154 rid ASC;
155
@@ -158,7 +169,8 @@
169 UNION
170 SELECT msg FROM skipcheckinrids;
171
172 EOF
173
174 #cat $ridlist
175 fossil export --git --import-marks $ridlist $newrepo
176
177

Keyboard Shortcuts

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