2 fd7552d2 2023-07-17 mark * Copyright (c) 2023 Mark Jamsek <mark@jamsek.dev>
4 fd7552d2 2023-07-17 mark * Permission to use, copy, modify, and distribute this software for any
5 fd7552d2 2023-07-17 mark * purpose with or without fee is hereby granted, provided that the above
6 fd7552d2 2023-07-17 mark * copyright notice and this permission notice appear in all copies.
8 fd7552d2 2023-07-17 mark * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 fd7552d2 2023-07-17 mark * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 fd7552d2 2023-07-17 mark * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 fd7552d2 2023-07-17 mark * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 fd7552d2 2023-07-17 mark * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 fd7552d2 2023-07-17 mark * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 fd7552d2 2023-07-17 mark * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 fd7552d2 2023-07-17 mark * Commit keywords to specify references in the repository
19 fd7552d2 2023-07-17 mark * (cf. svn keywords, fossil special tags, hg revsets).
21 fd7552d2 2023-07-17 mark #define GOT_KEYWORD_BASE "base" /* work tree base commit */
22 fd7552d2 2023-07-17 mark #define GOT_KEYWORD_HEAD "head" /* worktree/repo HEAD commit */
25 fd7552d2 2023-07-17 mark * Parse a commit id string for keywords and/or lineage modifiers "(+|-)[N]".
26 fd7552d2 2023-07-17 mark * Valid keywords are "base" or "head" and must be prefixed with a ":".
27 fd7552d2 2023-07-17 mark * Lineage modifiers must be prefixed with a ":" and may suffix keywords or
28 fd7552d2 2023-07-17 mark * reference names:
29 fd7552d2 2023-07-17 mark * :keyword:(+/-)N Nth generation descendant/antecedent of keyword
30 fd7552d2 2023-07-17 mark * :keyword:(+/-) 1st generation descendant/antecedent of keyword
31 fd7552d2 2023-07-17 mark * :keyword commit pointed to by keyword
32 fd7552d2 2023-07-17 mark * ref:(+/-)[N] Nth generation descendant/antecedent of ref
33 fd7552d2 2023-07-17 mark * If a match is found, return the corresponding commit id string in the
34 fd7552d2 2023-07-17 mark * char ** out parameter, of which the caller takes ownership and must free.
35 fd7552d2 2023-07-17 mark * Otherwise it will contain NULL, indicating a match was not found.
36 fd7552d2 2023-07-17 mark * If the modifier is greater than the number of ancestors/descendants, the id
37 fd7552d2 2023-07-17 mark * string of the oldest/most recent commit (i.e., ROOT/HEAD) will be returned.
39 fd7552d2 2023-07-17 mark const struct got_error *got_keyword_to_idstr(char **, const char *,
40 fd7552d2 2023-07-17 mark struct got_repository *, struct got_worktree *);