Fossil SCM

Add a TODO comment to the branch_of_file_rid() function.

drh 2020-05-06 11:51 artifact-view-links
Commit d462f87d8a473b0743f853a807dc840cc6f608d882df3bf9945e59db52021231
1 file changed +21 -2
+21 -2
--- src/branch.c
+++ src/branch.c
@@ -47,12 +47,31 @@
4747
}
4848
return zBr;
4949
}
5050
5151
/*
52
-** Same as branch_of_ckin_rid() except that it takes a file RID, not a
53
-** check-in RID.
52
+** If RID refers to a file, return the name of one of the branches in which
53
+** the file is used. If the RID file is used in more than one branch, then
54
+** the branch name returned is selected arbitrarily from the available
55
+** choices.
56
+**
57
+** Space to hold the returned value is obtained from fossil_malloc()
58
+** and should be freed by the caller.
59
+**
60
+** TODO:
61
+** Should the "arbitrary" choice of branch be made deterministic?
62
+** Perhaps the algorithm should be:
63
+** 1. Use "trunk" if it is available
64
+** 2. Use select the branch in which the file was first used
65
+** if it is never used in trunk.
66
+** That algorithm can be implemented (I think) by adding:
67
+**
68
+** ... ORDER BY value<>'trunk', tagxref.mtime LIMIT 1
69
+**
70
+** Maybe step 2 of the algorithm should be the most recent use of
71
+** the file rather than the first use? That can be achieved by
72
+** putting a DESC on the second term of the ORDER BY.
5473
*/
5574
char *branch_of_file_rid(int rid){
5675
char *zBr = 0;
5776
static Stmt q;
5877
db_static_prepare(&q,
5978
--- src/branch.c
+++ src/branch.c
@@ -47,12 +47,31 @@
47 }
48 return zBr;
49 }
50
51 /*
52 ** Same as branch_of_ckin_rid() except that it takes a file RID, not a
53 ** check-in RID.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54 */
55 char *branch_of_file_rid(int rid){
56 char *zBr = 0;
57 static Stmt q;
58 db_static_prepare(&q,
59
--- src/branch.c
+++ src/branch.c
@@ -47,12 +47,31 @@
47 }
48 return zBr;
49 }
50
51 /*
52 ** If RID refers to a file, return the name of one of the branches in which
53 ** the file is used. If the RID file is used in more than one branch, then
54 ** the branch name returned is selected arbitrarily from the available
55 ** choices.
56 **
57 ** Space to hold the returned value is obtained from fossil_malloc()
58 ** and should be freed by the caller.
59 **
60 ** TODO:
61 ** Should the "arbitrary" choice of branch be made deterministic?
62 ** Perhaps the algorithm should be:
63 ** 1. Use "trunk" if it is available
64 ** 2. Use select the branch in which the file was first used
65 ** if it is never used in trunk.
66 ** That algorithm can be implemented (I think) by adding:
67 **
68 ** ... ORDER BY value<>'trunk', tagxref.mtime LIMIT 1
69 **
70 ** Maybe step 2 of the algorithm should be the most recent use of
71 ** the file rather than the first use? That can be achieved by
72 ** putting a DESC on the second term of the ORDER BY.
73 */
74 char *branch_of_file_rid(int rid){
75 char *zBr = 0;
76 static Stmt q;
77 db_static_prepare(&q,
78

Keyboard Shortcuts

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