commit - 48c8c60d8b401706b7df49fd50a9d298728e8c7b
commit + b672a97aba1aa83f89f3627751bd54950b5d6f9b
blob - eaedd62596e47aa25d6282eee093c8f0dea5accc
blob + 8a8c625f465ddc125e61527f4aed9313324f3e9e
--- tog/tog.1
+++ tog/tog.1
.Nm
are as follows:
.Bl -tag -width blame
-.It Cm log Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Op Ar path
+.It Cm log Oo Fl b Oc Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Op Ar path
Display history of a repository.
If a
.Ar path
key is pressed.
.It Cm Ctrl+l
Reload the log view with new commits found in the repository.
+.It Cm B
+Reload the log view and toggle display of merged commits.
+The
+.Fl b
+option determines whether merged commits are displayed initially.
.El
.Pp
The options for
.Cm tog log
are as follows:
.Bl -tag -width Ds
+.It Fl b
+Display individual commits which were merged into the current branch.
+By default,
+.Cm tog log
+shows the linear history of the current branch only.
+The
+.Cm B
+key binding can be used to toggle display of merged commits at run-time.
.It Fl c Ar commit
Start traversing history at the specified
.Ar commit .
blob - 77eb088348f4e16807aae3ee3636a691eb0df3b6
blob + ddf4b1a9ec47ef9b9c7ce57f81d79a49765d51ab
--- tog/tog.c
+++ tog/tog.c
int selected;
char *in_repo_path;
const char *head_ref_name;
+ int log_branches;
struct got_repository *repo;
struct got_reflist_head *refs;
struct got_object_id *start_id;
static const struct got_error *open_log_view(struct tog_view *,
struct got_object_id *, struct got_reflist_head *,
- struct got_repository *, const char *, const char *, int);
+ struct got_repository *, const char *, const char *, int, int);
static const struct got_error * show_log_view(struct tog_view *);
static const struct got_error *input_log_view(struct tog_view **,
struct tog_view **, struct tog_view **, struct tog_view *, int);
{
endwin();
fprintf(stderr,
- "usage: %s log [-c commit] [-r repository-path] [path]\n",
+ "usage: %s log [-b] [-c commit] [-r repository-path] [path]\n",
getprogname());
exit(1);
}
static const struct got_error *
open_log_view(struct tog_view *view, struct got_object_id *start_id,
struct got_reflist_head *refs, struct got_repository *repo,
- const char *head_ref_name, const char *path, int check_disk)
+ const char *head_ref_name, const char *path, int check_disk,
+ int log_branches)
{
const struct got_error *err = NULL;
struct tog_log_view_state *s = &view->state.log;
err = got_error_from_errno("got_object_id_dup");
goto done;
}
+ s->log_branches = log_branches;
SIMPLEQ_INIT(&s->colors);
if (has_colors() && getenv("TOG_COLORS") != NULL) {
err = got_repo_open(&thread_repo, got_repo_get_path(repo), NULL);
if (err)
goto done;
- err = got_commit_graph_open(&thread_graph, s->in_repo_path, 0);
+ err = got_commit_graph_open(&thread_graph, s->in_repo_path,
+ !s->log_branches);
if (err)
goto done;
err = got_commit_graph_iter_start(thread_graph,
return got_error_from_errno(
"view_open");
err = open_log_view(lv, s->start_id, s->refs,
- s->repo, s->head_ref_name, parent_path, 0);
+ s->repo, s->head_ref_name, parent_path, 0,
+ s->log_branches);
if (err)
return err;;
if (view_is_parent_view(view))
return err;
}
err = open_log_view(lv, start_id, s->refs, s->repo,
- s->head_ref_name, in_repo_path, 0);
+ s->head_ref_name, in_repo_path, 0, s->log_branches);
if (err) {
free(start_id);
+ view_close(lv);
+ return err;;
+ }
+ *dead_view = view;
+ *new_view = lv;
+ break;
+ case 'B':
+ s->log_branches = !s->log_branches;
+ err = stop_log_thread(s);
+ if (err)
+ return err;
+ lv = view_open(view->nlines, view->ncols,
+ view->begin_y, view->begin_x, TOG_VIEW_LOG);
+ if (lv == NULL)
+ return got_error_from_errno("view_open");
+ err = open_log_view(lv, s->start_id, s->refs, s->repo,
+ s->head_ref_name, s->in_repo_path, 0, s->log_branches);
+ if (err) {
view_close(lv);
return err;;
}
struct got_object_id *start_id = NULL;
char *path = NULL, *repo_path = NULL, *cwd = NULL;
char *start_commit = NULL, *head_ref_name = NULL;
- int ch;
+ int ch, log_branches = 0;
struct tog_view *view;
SIMPLEQ_INIT(&refs);
err(1, "pledge");
#endif
- while ((ch = getopt(argc, argv, "c:r:")) != -1) {
+ while ((ch = getopt(argc, argv, "bc:r:")) != -1) {
switch (ch) {
+ case 'b':
+ log_branches = 1;
+ break;
case 'c':
start_commit = optarg;
break;
}
}
error = open_log_view(view, start_id, &refs, repo, head_ref_name,
- path, 1);
+ path, 1, log_branches);
if (error)
goto done;
if (worktree) {
if (err)
return err;
- err = open_log_view(log_view, commit_id, refs, repo, NULL, path, 0);
+ err = open_log_view(log_view, commit_id, refs, repo, NULL, path, 0, 0);
if (err)
view_close(log_view);
else