commit - 66c06eb12bec7b816963355327e0b3b53db5e881
commit + b584caa3e8756aeac18e4d5b3c63cdc8b17ad9ea
blob - 60c761947d9b8dfb848269d6bba3e25b341bf7d6
blob + 5d94c4ade9d0584ccb4b04bf99cb1c7f8a4d8745
--- got/got.c
+++ got/got.c
struct got_repository *repo, const char *path,
struct got_pathlist_head *changed_paths,
struct got_diffstat_cb_arg *diffstat, int show_patch, int diff_context,
- struct got_reflist_object_id_map *refs_idmap, const char *custom_refs_str)
+ struct got_reflist_object_id_map *refs_idmap, const char *custom_refs_str,
+ const char *prefix)
{
const struct got_error *err = NULL;
FILE *f = NULL;
printf(GOT_COMMIT_SEP_STR);
if (custom_refs_str)
- printf("commit %s (%s)\n", id_str, custom_refs_str);
+ printf("%s %s (%s)\n", prefix ? prefix : "commit", id_str,
+ custom_refs_str);
else
- printf("commit %s%s%s%s\n", id_str, refs_str ? " (" : "",
- refs_str ? refs_str : "", refs_str ? ")" : "");
+ printf("%s %s%s%s%s\n", prefix ? prefix : "commit", id_str,
+ refs_str ? " (" : "", refs_str ? refs_str : "",
+ refs_str ? ")" : "");
free(id_str);
id_str = NULL;
free(refs_str);
(show_changed_paths || show_diffstat) ?
&changed_paths : NULL,
show_diffstat ? &dsa : NULL, show_patch,
- diff_context, refs_idmap, NULL);
+ diff_context, refs_idmap, NULL, NULL);
got_object_commit_close(commit);
if (err)
break;
(show_changed_paths || show_diffstat) ?
&changed_paths : NULL,
show_diffstat ? &dsa : NULL, show_patch,
- diff_context, refs_idmap, NULL);
+ diff_context, refs_idmap, NULL, NULL);
got_object_commit_close(commit);
if (err)
break;
struct got_reflist_object_id_map *refs_idmap = NULL;
struct got_commit_object *commit = NULL;
struct got_object_id *id = NULL;
+ const char *header_prefix;
char *uuidstr = NULL;
int found = 0;
if (strncmp(wanted_ref, "refs/heads/", 11) == 0)
wanted_ref += 11;
}
+
+ if (strcmp(ref_prefix, GOT_WORKTREE_BACKOUT_REF_PREFIX) == 0)
+ header_prefix = "backout";
+ else
+ header_prefix = "cherrypick";
TAILQ_FOREACH(re, &refs, entry) {
- const char *refname;
+ const char *refname, *wt;
refname = got_ref_get_name(re->ref);
else
continue;
+ wt = refname;
+
if (worktree == NULL || strncmp(refname, uuidstr,
GOT_WORKTREE_UUID_STRLEN) == 0)
refname += GOT_WORKTREE_UUID_STRLEN + 1; /* skip '-' */
goto done;
err = print_commit(commit, id, repo, NULL,
- &paths, NULL, 0, 0, refs_idmap, NULL);
+ &paths, NULL, 0, 0, refs_idmap, NULL,
+ header_prefix);
got_pathlist_free(&paths,
GOT_PATHLIST_FREE_ALL);
+
+ if (worktree == NULL)
+ printf("work tree: %.*s\n\n",
+ GOT_WORKTREE_UUID_STRLEN, wt);
}
if (err || found)
goto done;
return got_error_from_errno("asprintf");
err = print_commit(old_commit, old_commit_id, repo, NULL, NULL, NULL,
- 0, 0, refs_idmap, custom_refs_str);
+ 0, 0, refs_idmap, custom_refs_str, NULL);
if (err)
goto done;
blob - bf66824996f21369543f644f760e178198b0d78a
blob + 1a217d6ed3b9754e118aea878d1450e35c34790d
--- regress/cmdline/backout.sh
+++ regress/cmdline/backout.sh
for r in $sorted; do
echo $sep >> $testroot/stdout.expected
if [ $r == $branch_rev ]; then
- echo "commit $r" >> $testroot/stdout.expected
+ echo "backout $r" >> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date" >> $testroot/stdout.expected
printf " \n $logmsg\n \n" >> $testroot/stdout.expected
echo "Deleted: $ymd $short_id $logmsg" >> \
$testroot/stdout.wt_deleted
else
- echo "commit $r (newbranch)" \
+ echo "backout $r (newbranch)" \
>> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date2" >> $testroot/stdout.expected
# only show log message ref of the specified commit id
echo $sep > $testroot/stdout.expected
- echo "commit $branch_rev" >> $testroot/stdout.expected
+ echo "backout $branch_rev" >> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date" >> $testroot/stdout.expected
printf " \n $logmsg\n \n" >> $testroot/stdout.expected
# only show log message ref of the specified symref
echo $sep > $testroot/stdout.expected
- echo "commit $branch_rev2 (newbranch)" >> $testroot/stdout.expected
+ echo "backout $branch_rev2 (newbranch)" >> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date2" >> $testroot/stdout.expected
printf " \n $logmsg2\n \n" >> $testroot/stdout.expected
for r in $sorted; do
echo $sep >> $testroot/stdout.expected
if [ $r == $branch2_rev ]; then
- echo "commit $r" >> $testroot/stdout.expected
+ echo "backout $r" >> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date" >> $testroot/stdout.expected
printf " \n $b2_logmsg\n \n" >> \
printf "$b2_changeset\n\n" >> \
$testroot/stdout.expected
else
- echo "commit $r (newbranch2)" \
+ echo "backout $r (newbranch2)" \
>> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date2" >> $testroot/stdout.expected
echo -n > $testroot/stdout.expected
for r in $sorted; do
- echo "commit $r" >> $testroot/stdout.expected
+ echo "backout $r" >> $testroot/stdout.expected
done
- (cd $testroot/repo && got backout -l | grep ^commit | \
+ (cd $testroot/repo && got backout -l | grep ^backout | \
sort | cut -f1,2 -d' ' > $testroot/stdout)
cmp -s $testroot/stdout.expected $testroot/stdout
# make sure the remaining ref in work tree 2 was not also deleted
echo $sep > $testroot/stdout.expected
- echo "commit $branch2_rev2 (newbranch2)" >> $testroot/stdout.expected
+ echo "backout $branch2_rev2 (newbranch2)" >> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date2" >> $testroot/stdout.expected
printf " \n $b2_logmsg2\n \n" >> $testroot/stdout.expected
blob - 2b2eb4582ce3a130bac8aedaf3901a84ce31458a
blob + 2cc07373cc5a1d2286aa7311f48980d94a8c0180
--- regress/cmdline/cherrypick.sh
+++ regress/cmdline/cherrypick.sh
for r in $sorted; do
echo $sep >> $testroot/stdout.expected
if [ $r == $branch_rev ]; then
- echo "commit $r" >> $testroot/stdout.expected
+ echo "cherrypick $r" >> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date" >> $testroot/stdout.expected
printf " \n $logmsg\n \n" >> $testroot/stdout.expected
echo "Deleted: $ymd $short_id $logmsg" >> \
$testroot/stdout.wt_deleted
else
- echo "commit $r (newbranch)" \
+ echo "cherrypick $r (newbranch)" \
>> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date2" >> $testroot/stdout.expected
# only show log message ref of the specified commit id
echo $sep > $testroot/stdout.expected
- echo "commit $branch_rev" >> $testroot/stdout.expected
+ echo "cherrypick $branch_rev" >> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date" >> $testroot/stdout.expected
printf " \n $logmsg\n \n" >> $testroot/stdout.expected
# only show log message ref of the specified symref
echo $sep > $testroot/stdout.expected
- echo "commit $branch_rev2 (newbranch)" >> $testroot/stdout.expected
+ echo "cherrypick $branch_rev2 (newbranch)" >> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date2" >> $testroot/stdout.expected
printf " \n $logmsg2\n \n" >> $testroot/stdout.expected
for r in $sorted; do
echo $sep >> $testroot/stdout.expected
if [ $r == $branch2_rev ]; then
- echo "commit $r" >> $testroot/stdout.expected
+ echo "cherrypick $r" >> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date" >> $testroot/stdout.expected
printf " \n $b2_logmsg\n \n" >> \
printf "$b2_changeset\n\n" >> \
$testroot/stdout.expected
else
- echo "commit $r (newbranch2)" \
+ echo "cherrypick $r (newbranch2)" \
>> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date2" >> $testroot/stdout.expected
echo -n > $testroot/stdout.expected
for r in $sorted; do
- echo "commit $r" >> $testroot/stdout.expected
+ echo "cherrypick $r" >> $testroot/stdout.expected
done
- (cd $testroot/repo && got cherrypick -l | grep ^commit | \
+ (cd $testroot/repo && got cherrypick -l | grep ^cherrypick | \
sort | cut -f1,2 -d' ' > $testroot/stdout)
cmp -s $testroot/stdout.expected $testroot/stdout
# make sure the remaining ref in work tree 2 was not also deleted
echo $sep > $testroot/stdout.expected
- echo "commit $branch2_rev2 (newbranch2)" >> $testroot/stdout.expected
+ echo "cherrypick $branch2_rev2 (newbranch2)" \
+ >> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $date2" >> $testroot/stdout.expected
printf " \n $b2_logmsg2\n \n" >> $testroot/stdout.expected
blob - 9d6cc96be651e682ca185e858f8dfff8eaca919a
blob + 6005da9a4302b4e31d5dc9469c9c35b7abef803f
--- regress/cmdline/commit.sh
+++ regress/cmdline/commit.sh
# confirm logmsg ref was not deleted with got cherrypick -l
echo "-----------------------------------------------" \
> $testroot/stdout.expected
- echo "commit $branch_rev (newbranch)" >> $testroot/stdout.expected
+ echo "cherrypick $branch_rev (newbranch)" >> $testroot/stdout.expected
echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
echo "date: $d" >> $testroot/stdout.expected
echo " " >> $testroot/stdout.expected