chiark / gitweb /
5dd24c3c25bccc8dcecd2110eb90b7b3ef85d927
[topbloke.git] / THEORY
1 GENERAL
2
3  C >= D                 C is descendant of D, partial order
4  C \haspatch D          C contains changes from D, partial order
5  Patch P has two sets P+, P-
6  Ancestors A(C,P) = { Ca \elem C | Ca \elem P }
7  Ends E(C,P) = maximal elements of A(C,P)
8
9 COMMIT ANNOTATIONS
10
11  Commit C is annotated with:
12
13  P(C)
14    Either P s.t. C \elem P
15    or \bottom meaning \notexists_{P} C \elem P.
16
17  For every Px, E(C,Px+)
18    Implicitly for C \elem Pc+, E(C,Pc+) = { C } 
19    and this is not annotated explicitly.
20    Also implicitly for P(C) = \bottom, \forall_{Px} E(C,Px+) = { }
21    and this is also not annotated explicitly.
22
23 SIMPLE COMMIT
24
25  make C >1 { A } 
26  from A
27
28  with contents
29   D \isin C <=> D \isin A v D = C
30
31  results
32   P(C) = P(A)
33   A \haspatch P <=> C \haspatch P
34   For A \notelem Px+: E(C,Px+) = E(A,Px+)
35       A \elem Px+: E(C,Px+) = { C } -- not annotated
36
37 ANTICOMMIT
38
39  make C >1 { L }
40  from L, R+, R- 
41
42  with contents
43   D \isin C <=> D \notelement Pr+ ^ D \isin L
44
45  where
46   P(R+) = Pr+, P(R-) = Pr-
47   E(L,Pr+) = { R+ }    -- nontrivial, may need R+' = merge of E(L,Pr+)
48   B(R+) = R-
49   L \haspatch Pr
50
51  results
52   P(C) = P(L) = Pl-
53   If C \elem P+, B(C) = B(L); otherwise B(C) n/a
54   For P = Pr:  C \nothaspatch Pr
55                E(C,Pr+) = E(L,Pr+) = { R+ }
56       P != Pr: C \haspatch P <=> L \haspatch P
57                E(C,P+) = E(L,P+)
58
59 MERGE
60
61  make C >1 { L, R }
62  from L, R, M
63
64  with contents
65   D \isin C <=> [ (D \isin    L ^ D \isin    R) v D =  C : T            ]
66                 [  D \notisin L ^ D \notisin R  ^ D != C : F            ]
67                 [  otherwise                             : D \notisin M ]
68
69  where
70   M < L, M < R
71   If L \elem P+:
72       R \elem P+ ^ B(R) = B(L)            -- only merge tips with same base
73     v R \elem P- ^ R >= B(L) ^ M = B(L)   -- base when merging into tip
74   If L \elem P-:
75       R \nothaspatch P
76   If L \haspatch P <=/=> R \haspatch P:
77       \forall Ce \elem E(R,P+): Ce <= L   -- may need to merge E(R,P+) into L
78
79  results
80   P(C) = P(L)
81   B(C) = 
82     For C \notelem P+:             n/a
83         C \elem P+, R \elem P+:    B(L) = B(R)
84         C \elem P+, R \notelem P+: R >= B(L)
85
86   C \haspatch P =
87     For L \nothaspatch P, R \nothaspatch P: F
88         L \haspatch P,    R \haspatch P:    T
89         otherwise:                          M \nothaspatch P
90   E(C,P+) = maximal elements of E(L,P+) \union E(R,P+)
91           = { Cl | \notexist Cr \elem E(R,P+): Cr >= Cl } \union
92             { Cr | \notexist Cl \elem E(L,P+): Cl >= Cr }
93
94  -- to reintroduce a dep, set P(C)=P(L)=Pl-, P(R)=Pr+, M=B(R)
95     where L \notelem Pr obv.
96
97
98 CREATE BASE
99
100  make B >1 { L }
101  from L, P
102
103  where
104   P(L) = Pl+ v P(L) = \bottom
105   P(L) != P(B)
106   E(B,P+) = { }
107
108  with contents
109   D \isin B <=> D \isin L v D = B
110
111  results
112   P(B) = Pb-
113   B(C) n/a
114   E(B,Px+) = E(L,Px+)
115   B \haspatch P <=> L \haspatch P
116
117
118 CREATE TIP
119
120  make C >1 { B}
121  from B
122
123  where
124   B \elem Pb-
125   E(B,P+) = { }
126
127  with contents
128   D \isin C <=> D \isin B v D = C
129
130  results
131   P(C) = Pb+
132   B(C) = B
133   C \haspatch P =
134     For P != Pb: B \haspatch P
135         P = Pb:  T