Fossil with Commonmark

Changes On Branch dtrg-bundles
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch dtrg-bundles Excluding Merge-Ins

This is equivalent to a diff from e05a74f1f4 to 22048c41dc

2014-10-19
10:28
The setup_settings page now only opens a checkout if no explicit repo was provided, to avoid it showing versioned properties from a different repo. Problem reported on the ML. check-in: 0ab0079959 user: stephan tags: trunk
2014-10-18
22:13
More simplification; now correctly handles branches in newrepo (i.e. only the desired branch is exported). Closed-Leaf check-in: 22048c41dc user: dg tags: dtrg-bundles
21:40
Optimised and simplified the exporter. Haven't figured out how to make the imported tree match up with its parent commit yet. check-in: df4435bf4d user: dg tags: dtrg-bundles
19:26
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. check-in: f809eb4c1a user: dg tags: dtrg-bundles
19:18
Enhance the "fossil timeline" command so that one can specify a file or directory as a command-line argument and the timeline only shows check-ins that involve that particular file or any of the files in the named directory. check-in: e05a74f1f4 user: drh tags: trunk
10:34
Fix the directory matching logic for the command-line timeline so that it works with case insensitive filesystems. Other cleanups and improvements to the new timeline logic are also included. Closed-Leaf check-in: 8af7f6185a user: drh tags: cmdline-timeline-enhancement
2014-10-17
23:51
Use more aggressive cleanup when coming back from the 'sqlite' command, to permit TH1 hooks to exit cleanly. check-in: b8b037610f user: mistachkin tags: trunk

Added test/make-bundle-data.sh.































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#!/bin/sh
# This script creates the two repositories used by the bundle test tools.
# Syntax: make-bundle-data.sh oldrepo.fossil newrepo.fossil
# Warning! The two repositories will be *destroyed*!

set -e -x

oldrepo=$(readlink -f "$1")
newrepo=$(readlink -f "$2")

tmpdir=/tmp/$$.make-bundle-data

rm -rf $oldrepo $newrepo $tmpdir
fossil init $oldrepo
mkdir $tmpdir
(cd $tmpdir && fossil open $oldrepo && fossil settings -R $oldrepo autosync off)
(cd $tmpdir && echo "empty" > 1 && fossil add 1 && fossil commit -m "Empty")
(cd $tmpdir && echo "data" >> 1 && fossil commit -m "Add: data")
(cd $tmpdir && echo "more data" >> 1 && fossil commit -m "Add: more data")

fossil clone $oldrepo $newrepo
rm -rf $tmpdir
mkdir $tmpdir
(cd $tmpdir && fossil open $newrepo && fossil settings -R $oldrepo autosync off)
(cd $tmpdir && echo "even more data" >> 1 && fossil commit -m "Clone, add: even more data")
(cd $tmpdir && fossil tag add branchpoint tip)
(cd $tmpdir && echo "new file" > 2 && fossil add 2 && fossil commit -m "New file")
(cd $tmpdir && fossil update branchpoint)
(cd $tmpdir && echo "branched data" >> 1 && fossil commit -b branch -m "Branch, add: branched data")

Added tools/exportbundle.sh.

















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#!/bin/sh
# This is a very, very prototype proof-of-concept tool to generate 'push
# requests'. It diffs two repositories (currently only local ones) and
# generates a bundle which contains all the artifacts needed to
# reproduce a particular artifact.
# 
# The intended workflow is: user says 'I want to make a bundle to update
# OLD.fossil to checkin X of NEW.fossil'; the tool walks the checkin tree
# of NEW.fossil to figure out what checkins are necessary to reproduce X;
# then it removes all the checkins which are present in OLD.fossil; then
# it emits the bundle.
#
# To import, simple clone oldrepo (or not, if you're feeling brave);
# then fossil import --incremental the bundle.

set -e

oldrepo=$1
newrepo=$2
artifact=$3

ridlist=ridlist

fossil sqlite3 >$ridlist <<-EOF

ATTACH DATABASE "$newrepo" AS new;
ATTACH DATABASE "$oldrepo" AS old;

-- Map of parent -> child checkin artifacts. This contains our checkin graph.

CREATE TEMPORARY VIEW newcheckinmap AS
	SELECT
		child.uuid AS child,
		child.rid AS rid,
		parent.uuid AS parent,
		parent.rid AS parentrid,
		plink.mtime AS mtime
	FROM
		new.plink,
		new.blob AS parent,
		new.blob AS child
	WHERE
		(child.rid = plink.cid)
		AND (parent.rid = plink.pid);
	
CREATE TEMPORARY VIEW oldcheckinmap AS
	SELECT
		child.uuid AS child,
		child.rid AS rid,
		parent.uuid AS parent,
		parent.rid AS parentrid,
		plink.mtime AS mtime
	FROM
		old.plink,
		old.blob AS parent,
		old.blob AS child
	WHERE
		(child.rid = plink.cid)
		AND (parent.rid = plink.pid);
	
-- Create sets of all checkins.

CREATE TEMPORARY VIEW newcheckins AS
	SELECT
		blob.uuid AS id,
		blob.rid AS rid
	FROM
		new.blob, new.event
	ON
		blob.rid = event.objid
	WHERE
		event.type = "ci";

CREATE TEMPORARY VIEW oldcheckins AS
	SELECT
		blob.uuid AS id,
		blob.rid AS rid
	FROM
		old.blob, old.event
	ON
		blob.rid = event.objid
	WHERE
		event.type = "ci";

-- Now create maps of checkin->file artifacts.

CREATE TEMPORARY VIEW newfiles AS
	SELECT
		checkin.uuid AS checkin,
		file.uuid AS file,
		file.rid AS rid
	FROM
		new.mlink,
		new.blob AS checkin,
		new.blob AS file
	WHERE
		(checkin.rid = mlink.mid)
		AND (file.rid = mlink.fid);

-- Walk the tree and figure out what checkins need to go into the bundle.

CREATE TEMPORARY VIEW desiredcheckins AS
	WITH RECURSIVE
	  ancestors(id, mtime) AS (
			SELECT child AS id, mtime
			FROM newcheckinmap
			WHERE child LIKE "$artifact%"
		UNION 
			SELECT
				newcheckinmap.parent AS id,
				newcheckinmap.mtime
			FROM
				newcheckinmap, ancestors
			ON
				newcheckinmap.child = ancestors.id
			WHERE
				-- Filter to only include checkins which *aren't* in oldrepo.
				NOT EXISTS(SELECT * FROM oldcheckinmap WHERE
					oldcheckinmap.child = newcheckinmap.parent)
			ORDER BY
				newcheckinmap.mtime DESC
	  )
	SELECT * FROM ancestors;

-- Now we know what checkins are going in the bundle, figure out which
-- files get included.

CREATE TEMPORARY VIEW desiredfiles AS
	SELECT
		newfiles.file AS id
	FROM
		newfiles,
		desiredcheckins
	WHERE
		newfiles.checkin = desiredcheckins.id;

-- Because this prototype is using the git exporter to create bundles, and the
-- exporter's ability to select artifacts is based on having a list of rids to
-- ignore, we have to emit a list of all rids in newrepo which don't correspond
-- to the list above.

CREATE TEMPORARY VIEW skipcheckinrids AS
	SELECT
		"c" || newcheckins.rid AS msg,
		newcheckins.rid AS rid,
		newcheckins.id AS id
	FROM
		newcheckins LEFT JOIN desiredcheckins
	ON
		desiredcheckins.id = newcheckins.id
	WHERE
		desiredcheckins.id IS NULL
	ORDER BY
		rid ASC;

CREATE TEMPORARY VIEW skipfilerids AS
	SELECT
		"b" || newfiles.rid AS msg,
		newfiles.rid AS rid,
		newfiles.file AS id
	FROM
		newfiles, skipcheckinrids
	WHERE
		newfiles.checkin = skipcheckinrids.id
	ORDER BY
		rid ASC;

SELECT msg FROM skipfilerids
UNION
SELECT msg FROM skipcheckinrids;

EOF

#cat $ridlist
fossil export --git --import-marks $ridlist $newrepo

Added tools/importbundle.sh.














1
2
3
4
5
6
7
8
9
10
11
12
13
+
+
+
+
+
+
+
+
+
+
+
+
+
#!/bin/sh
# Imports a bundle which has been exported with exportbundle.
# Syntax: exportbundle.sh oldrepo.fossil newrepo.fossil data.bundle

set -e

oldrepo="$1"
newrepo="$2"
bundle="$3"

fossil clone $oldrepo $newrepo
fossil import --incremental $newrepo < $bundle