45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
if( zMain==0 ) zMain = db_get("main-branch",0);
zBr = fossil_strdup(zMain);
}
return zBr;
}
/*
** Same as branch_of_ckin_rid() except that it takes a file RID, not a
** check-in RID.
*/
char *branch_of_file_rid(int rid){
char *zBr = 0;
static Stmt q;
db_static_prepare(&q,
"SELECT value FROM tagxref, mlink"
" WHERE rid=mlink.mid"
|
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
|
if( zMain==0 ) zMain = db_get("main-branch",0);
zBr = fossil_strdup(zMain);
}
return zBr;
}
/*
** If RID refers to a file, return the name of one of the branches in which
** the file is used. If the RID file is used in more than one branch, then
** the branch name returned is selected arbitrarily from the available
** choices.
**
** Space to hold the returned value is obtained from fossil_malloc()
** and should be freed by the caller.
**
** TODO:
** Should the "arbitrary" choice of branch be made deterministic?
** Perhaps the algorithm should be:
** 1. Use "trunk" if it is available
** 2. Use select the branch in which the file was first used
** if it is never used in trunk.
** That algorithm can be implemented (I think) by adding:
**
** ... ORDER BY value<>'trunk', tagxref.mtime LIMIT 1
**
** Maybe step 2 of the algorithm should be the most recent use of
** the file rather than the first use? That can be achieved by
** putting a DESC on the second term of the ORDER BY.
*/
char *branch_of_file_rid(int rid){
char *zBr = 0;
static Stmt q;
db_static_prepare(&q,
"SELECT value FROM tagxref, mlink"
" WHERE rid=mlink.mid"
|