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
|
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
|
-
+
-
+
-
-
+
+
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
+
|
since the last release you took, and merges only that into your copy, so your own
changes stay.
This repository does exactly that. Its trunk is project A, `notes`, a small tool
that prints text wrapped to a width. The `vendor-wrap` branch holds B, a tiny
library called `wrap`, through three releases.
See it all at once on the [timeline](https://fossil.craftdesign.group/fossil-examples/timeline?n=all&y=ci).
See it all at once on the [timeline](/timeline?n=all&y=ci).
## Where the vendor branch starts
The vendor branch starts from the repository's first check-in, the
"[initial empty check-in](https://fossil.craftdesign.group/fossil-examples/info/f2e1f9f4c8)" that `fossil new` makes. It has no
"[initial empty check-in](/info/f2e1f9f4c8)" that `fossil new` makes. It has no
files, so the vendor branch carries none of A's files, only B. But trunk
descends from it, so the two branches share an ancestor and merge normally.
A truly separate root (made with `fossil open --empty` and a first commit)
doesn't work for this: `fossil merge` refuses it with "cannot find a common
ancestor". Branching from your latest code does work, but it puts all of A's
files on the vendor branch too.
## The history
Upstream releases arrive on `vendor-wrap` exactly as shipped, and each one is
merged down into trunk. From the moment A patches its copy of wrap, that change
Time runs down the page. Upstream releases arrive on `vendor-wrap` exactly as
shipped, and each one is merged across into trunk. From the moment A patches its copy of wrap, that change
rides along trunk through every later release, including the one that renames
the file.
```pikchr center
scale = 0.9
fontscale = 1.0
thickness = 0.015
arrowht = 0.08; arrowwid = 0.06
$ink = 0x29333a; $muted = 0x53616c; $rule = 0x6b737b
$base = 0xe7eef2; $vend = 0xdde8f3; $accent = 0x9a3f08; $patch = 0xf6e2d2
$r = 0.09
$top = 1.25
$r = 0.085
$vx = 1.7
$lx = -0.28
$rx = $vx + 0.28
# lane labels
text "vendor-wrap" italic rjust color $muted at (-0.25, $top)
text "upstream, as shipped" small rjust color $muted at (-0.25, $top - 0.17)
text "trunk" italic rjust color $muted at (-0.25, 0)
text "project A" small rjust color $muted at (-0.25, -0.17)
# column headings
text "TRUNK" bold at (0, 0.62)
text "project A" small color $muted at (0, 0.46)
text "VENDOR-WRAP" bold at ($vx, 0.62)
text "upstream, exactly as shipped" small color $muted at ($vx, 0.46)
# check-ins
Root: circle rad $r fill none color $rule dashed at (0, 0)
Start: circle rad $r fill $base color $ink at (0.75, 0)
V10: circle rad $r fill $vend color $ink at (1.4, $top)
M10: circle rad $r fill $base color $ink at (2.05, 0)
Patch: circle rad $r*1.35 fill $patch color $accent thick at (2.85, 0)
V11: circle rad $r fill $vend color $ink at (3.6, $top)
M11: circle rad $r fill $base color $ink at (4.25, 0)
V20: circle rad $r fill $vend color $ink at (5.0, $top)
M20: circle rad $r fill $base color $ink at (5.65, 0)
# check-ins, oldest at the top
Root: circle rad $r fill none color $rule dashed at (0, 0)
Start: circle rad $r fill $base color $ink at (0, -0.62)
Cont: circle rad $r fill $base color $ink at (0, -1.24)
V10: circle rad $r fill $vend color $ink at ($vx, -1.86)
M10: circle rad $r fill $base color $ink at (0, -2.48)
Use: circle rad $r fill $base color $ink at (0, -3.10)
Patch: circle rad $r*1.35 fill $patch color $accent thick at (0, -3.72)
V11: circle rad $r fill $vend color $ink at ($vx, -4.40)
M11: circle rad $r fill $base color $ink at (0, -5.10)
V20: circle rad $r fill $vend color $ink at ($vx, -5.86)
M20: circle rad $r fill $base color $ink at (0, -6.56)
# trunk: plain until the patch, then carrying A's change
# lanes
line from Root.e to Start.w color $ink
line from Start.e to M10.w color $ink
line from M10.e to Patch.w color $ink
# from the patch on, trunk carries A's change: drawn in the accent
line from Patch.e to M11.w color $accent thickness 0.04
line from M11.e to M20.w color $accent thickness 0.04
arrow from M20.e right 0.35 color $accent thickness 0.04
line from Root.n up $top - $r then right until even with V10.w then to V10.w rad 0.18 color $ink
line from Root.s to Start.n color $ink
line from Start.s to Cont.n color $ink
line from Cont.s to M10.n color $ink
line from M10.s to Use.n color $ink
line from Use.s to Patch.n color $ink
line from Patch.s to M11.n color $accent thickness 0.04
line from M11.s to M20.n color $accent thickness 0.04
arrow from M20.s down 0.35 color $accent thickness 0.04
line from V10.e to V11.w color $ink
line from V11.e to V20.w color $ink
# vendor-wrap: starts at the empty root, has no files of A's
line from Root.e right until even with V10 then to V10.n rad 0.2 color $ink
line from V10.s to V11.n color $ink
line from V11.s to V20.n color $ink
# merges: each release flows down into trunk
arrow from V10.s to M10.n chop dashed color $muted
arrow from V11.s to M11.n chop dashed color $muted
arrow from V20.s to M20.n chop dashed color $muted
# merges: fossil merge vendor-wrap, run on trunk
arrow from V10.w to M10.ne chop dashed color $muted
arrow from V11.w to M11.ne chop dashed color $muted
arrow from V20.w to M20.ne chop dashed color $muted
# upstream labels
text "wrap 1.0" bold at V10.n + (0, 0.17)
# trunk annotations, right-aligned to the left of the column
define tl { text $1 bold rjust at ($lx, $4.y + 0.14)
text "wrap 1.1" bold at V11.n + (0, 0.17)
text "off-by-one fix" small ljust color $muted at V11.s + (0.2, -0.16)
text "+wrap_test.c −legacy.c" small ljust color $muted at V11.s + (0.27, -0.31)
text "wrap 2.0" bold at V20.n + (0, 0.17)
text "wrap.c → textwrap.c" small ljust color $muted at V20.s + (0.2, -0.16)
text $2 small mono rjust color $muted at ($lx, $4.y - 0.02)
text $3 small rjust color $muted at ($lx, $4.y - 0.17) }
define tp { text $1 bold rjust color $accent at ($lx, $4.y + 0.14)
text $2 small mono rjust color $accent at ($lx, $4.y - 0.02)
text $3 small rjust color $accent at ($lx, $4.y - 0.17) }
tl("INITIAL EMPTY CHECK-IN", "f2e1f9f4c8", "fossil new; 0 files", Root)
tl("START notes", "cd2c8ca84b", "+notes.c +Makefile +README.md", Start)
tl("CONTINUE", "930eb4ff6b", "no wrap library yet", Cont)
tl("MERGE wrap 1.0", "e8cd137bb0", "ADDED vendor/wrap/* (4 files)", M10)
tl("USE wrap", "5781ae8096", "notes.c, Makefile edited", Use)
tp("PATCH wrap.c:7", "b9eed52216", "is_space() also breaks at '\\t'", Patch)
tl("MERGE wrap 1.1", "c977a16fd1", "MERGE wrap.c, +wrap_test.c, −legacy.c", M11)
text "PATCH RETAINED" small bold rjust color $accent at ($lx, M11.y - 0.32)
tl("MERGE wrap 2.0", "e305905700", "RENAME wrap.c → textwrap.c", M20)
text "PATCH RETAINED AT textwrap.c:7" small bold rjust color $accent at ($lx, M20.y - 0.32)
# trunk labels
text "empty first" small color $muted at Root.s - (0, 0.17)
text "check-in" small color $muted at Root.s - (0, 0.31)
# vendor annotations, left-aligned to the right of the column
define vl { text $1 bold ljust at ($rx, $4.y + 0.14)
text $2 small mono ljust color $muted at ($rx, $4.y - 0.02)
text $3 small ljust color $muted at ($rx, $4.y - 0.17) }
text "notes starts" small at Start.s - (0, 0.17)
text "merge 1.0" small at M10.s - (0, 0.17)
text "A patches wrap" bold color $accent at Patch.s - (0, 0.19)
text "break at tabs" small color $accent at Patch.s - (0, 0.35)
text "merge 1.1" small at M11.s - (0, 0.17)
text "patch kept" small color $accent at M11.s - (0, 0.33)
text "merge 2.0" small at M20.s - (0, 0.17)
text "patch follows" small color $accent at M20.s - (0, 0.33)
text "the rename" small color $accent at M20.s - (0, 0.47)
vl("IMPORT wrap 1.0", "ab245b7902", "4 files into vendor/wrap/", V10)
vl("IMPORT wrap 1.1", "6e37e4e613", "wrap.c:20 >= → >, +wrap_test.c, −legacy.c", V11)
vl("IMPORT wrap 2.0", "b6163fde93", "fossil mv wrap.c textwrap.c", V20)
```
Check-ins: [notes starts](https://fossil.craftdesign.group/fossil-examples/info/cd2c8ca84b) · [wrap 1.0](https://fossil.craftdesign.group/fossil-examples/info/ab245b7902) · [merge 1.0](https://fossil.craftdesign.group/fossil-examples/info/e8cd137bb0) · [A patches wrap](https://fossil.craftdesign.group/fossil-examples/info/b9eed52216) · [wrap 1.1](https://fossil.craftdesign.group/fossil-examples/info/6e37e4e613) · [merge 1.1](https://fossil.craftdesign.group/fossil-examples/info/c977a16fd1) · [wrap 2.0](https://fossil.craftdesign.group/fossil-examples/info/b6163fde93) · [merge 2.0](https://fossil.craftdesign.group/fossil-examples/info/e305905700)
Check-ins: [notes starts](/info/cd2c8ca84b) · [wrap 1.0](/info/ab245b7902) · [merge 1.0](/info/e8cd137bb0) · [A patches wrap](/info/b9eed52216) · [wrap 1.1](/info/6e37e4e613) · [merge 1.1](/info/c977a16fd1) · [wrap 2.0](/info/b6163fde93) · [merge 2.0](/info/e305905700)
What the merges of 1.1 and 2.0 printed:
fossil merge vendor-wrap (wrap 1.1)
UPDATE vendor/wrap/README.md
UPDATE vendor/wrap/wrap.h
MERGE vendor/wrap/wrap.c
|