Fossil SCM
Add a TODO comment to the branch_of_file_rid() function.
Commit
d462f87d8a473b0743f853a807dc840cc6f608d882df3bf9945e59db52021231
Parent
da1adac6d103743…
1 file changed
+21
-2
+21
-2
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -47,12 +47,31 @@ | ||
| 47 | 47 | } |
| 48 | 48 | return zBr; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /* |
| 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. | |
| 54 | 73 | */ |
| 55 | 74 | char *branch_of_file_rid(int rid){ |
| 56 | 75 | char *zBr = 0; |
| 57 | 76 | static Stmt q; |
| 58 | 77 | db_static_prepare(&q, |
| 59 | 78 |
| --- 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 |