Whenever a commit is selected in the graph pane, its SHA1 is
automatically put into the selection buffer for cut and paste.
However, some users may find this behavior annoying since it can
overwrite something they actually wanted to keep in the buffer.
This makes the behavior optional under the name "Auto-select SHA1",
but continues to default to "on".
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This allows gitk to be used to display a different set of refs each
the display is refreshed. This is useful when gitk is called from
other porcelain suites, for doing such things as displaying the set of
patches in a patch stack.
The user specifies a command as the argument to the --argscmd option.
The command is run initially and each time the display is refreshed,
and is expected to generate a list of commit IDs, one per line. Those
commits are appended to the commits passed on the command-line when
constructing the git log command to be executed.
The command is considered to be an attribute of a view, and has its
own field in the saved view, and an edit field in the view editor.
Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This also limits the window size to the screen size. That is better
than nothing, but it isn't perfect, since ideally we would take into
account window decorations, and things such as gnome panels or the
Mac OS X dock and menu bar, but I don't know how to do that.
On Cygwin this is as good as restoring the whole geometry (size and
position) at working around the Cygwin Tk bugs, according to Mark
Levedahl.
Tested-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Since we limit the rate at which we do updates to the canvas scrolling
regions, it's possible to get into selectline for a row that is
outside the currently-set scrolling region. When this happens,
selectline can't scroll to show the selected line, and as a
consequence, drawvisible chooses some other bogus row to be the
target row.
This fixes it by calling setcanvscroll from selectline in this case.
We also set selectedline (and currentid) before calling drawvisible
so that drawvisible makes the right choice of target row.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Occasionally I see a crash in selectline with commitinfo($id) not
set. This makes sure it is set by calling getcommit $id if it isn't.
Signed-off-by: Paul Mackerras <paulus@samba.org>
First, insertfakerow and removefakerow weren't updating vrowmod,
and hence displayorder was not getting updated when it needed to,
in the case where the fake row was being inserted into or removed
from the last arc. The comparison of varctok vs vtokmod was moved
into modify_arc for these cases (and for the call in rewrite_commit)
to avoid duplicating the extra code needed. Second, the logic in
update_arcrows didn't end up truncating displayorder and unsetting
cached_commitrow if the first modified row was in the last arc.
This fixes these problems.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Previously we passed the arguments indicating what commits the user
wants to view through git rev-parse to get a list of IDs (positive and
negative), then gave that to git log. This had a couple of problems,
notably that --merge and --left-right didn't get handled properly.
Instead we now just pass the original arguments to git log. When doing
an update, we append --not followed by the list of commits we have seen
that have no children, since we have got (or will get) their ancestors
from the first git log. If the first git log isn't finished yet, we
might get some duplicates from the second git log, but that doesn't
cause any problem.
Also get rid of the unused vnextroot variable.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Occasionally the target row stuff would scroll the display to some
uninteresting commit while reading. There were two problems: one
was that drawvisible would set targetrow even if there was no target
previously and no row selected, and the other was that it was possible
for the target row to get pushed down past numcommits, if drawvisible
was called after rows were added but before layoutmore got run.
The first problem is fixed by just not setting targetrow/id unless
there is a selected row or they were set previously.
The second problem is fixed by updating numcommits immediately new
rows are added. This leads to a simplification of layoutmore and
chewcommits but also means that some of the things that were done in
layoutmore now need to be done elsewhere, since layoutmore can no
longer use numcommits to know how much it has seen previously.
Hence the changes to getcommits, initlayout and setcanvscroll.
Signed-off-by: Paul Mackerras <paulus@samba.org>
When updating the graph, gitk uses a git log command with commit
limiting in order to get just the new commits. When path limiting
is also in effect, git log rewrites the parents of the commits it
outputs in order to represent just the subgraph that modifies the
listed paths, but it doesn't rewrite the parents on the boundary
of the graph. The result is that when updating, git log does not
give gitk the information about where the new commits join in to
the existing graph.
This solves the problem by explicitly rewriting boundary parents
when updating. If we are updating and are doing path limiting,
then when gitk finds an unlisted commit (one where git log puts a
"-" in front of the commit ID to indicate that it isn't actually
part of the graph), then gitk will execute:
git rev-list --first-parent --max-count=1 $id -- paths...
which returns the first ancestor that affects the listed paths.
(Currently gitk executes this synchronously; it could do it
asynchronously, which would be more complex but would avoid the
possibility of the UI freezing up if git rev-list takes a long time.)
Then, if the result is a commit that we know about, we rewrite the
parents of the children of the original commit to point to the new
commit. That is mostly a matter of adjusting the parents and children
arrays and calling fix_reversal to fix up the graph.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Because we weren't fixing up vlastins when moving an arc from one
place to another, it was possible for us later to decide to move
an arc to the wrong place, and end up with an arc disconnected from
the rest of the graph. This fixes it by updating vlastins when
necessary.
Signed-off-by: Paul Mackerras <paulus@samba.org>
This fixes a bug in updating the graph after we have cherry-picked
a commit in gitk and then added some new stuff externally. First,
we weren't updating viewincl with the new head added by the cherry-
pick. Secondly, getcommitlines was doing bad things if it saw a
commit that was already in the graph (was already in an arc). This
fixes both things. If getcommitlines sees a commit that is already
in the graph, it ignores it unless it was not listed before and is
listed now. In that case it doesn't assign it a new arc now, and
doesn't re-add the commit to its arc.
Signed-off-by: Paul Mackerras <paulus@samba.org>
There is an edit box where the number of context lines can be chosen.
But it was only used when regular diffs were displayed, not for
merge commits. This fixes it.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Paul Mackerras <paulus@samba.org>
It's really not very easy to visualize the commit walker,
because - on purpose - it obvously doesn't show the
uninteresting commits!
We will soon add a "--show-all" flag to the revision walker,
which will make it show uninteresting commits too, and they'll
have a '^' in front of them.
This is to update 'gitk' to show those negative commits in gray
to futureproof it.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
The insertrow/removerow functions were really only suitable for
inserting/removing a fake row such as the ones used for showing
the local changes. When used to insert a real new row from a
cherry-pick, they left things in an inconsistent state which then
caused various strange layout errors.
This renames insertrow/removerow to insertfakerow/removefakerow
and adds a new insertrow that does actually go to all the trouble
of creating a new arc and setting it up. This is more work but
keeps things consistent.
This also fixes a bug where cherrypick was not setting mainheadid,
and one where selectline wasn't always resulting in targetrow/id
being set to the selected row/id. Also insert/removefakerow now
adjust numcommits and call setcanvscroll.
Signed-off-by: Paul Mackerras <paulus@samba.org>
When creating a tag through gitk, and the tag name includes a slash (or
slashes), gitk errors out in a popup window. This patch makes gitk use
'git tag' to create the tag instead of modifying files in refs/tags/,
which fixes the issue; if 'git tag' throws an error, gitk pops up with
the error message.
The problem was reported by Frédéric Brière through
http://bugs.debian.org/464104
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Ignoring space changes can be helpful. For example, a commit
claims to only reformat source code and you quickly want to
verify if this claim is true. Or a commit accidentally changes
code formatting and you want to focus on the real changes.
In such cases a button to toggle of whitespace changes would be
quite handy. You could quickly toggle between seeing and
ignoring whitespace changes.
This commit adds such a checkbutton right above the diff view.
However, in general it is a good thing to see whitespace changes
and therefore the state of the checkbutton is not saved. For
example, space changes might happen unintentionally. But they are
real changes yielding different sha1s for the blobs involved.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
The "Key bindings" message under the "Help" menu was too long
and could not be parsed by the translation engine.
Fix both issues by translating one line at a time.
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Some of the stuff that commit 31c0eaa8cc
added to drawvisible isn't appropriate to do when we have no commits,
and this was causing a Tcl error if gitk was invoked in such a fashion
that no commits were selected. This fixes it by bailing out of
drawvisible early if there are no commits displayed.
Bug reported by Johannes Sixt.
Signed-off-by: Paul Mackerras <paulus@samba.org>
This fixes a bug where changing the commit range or file list for an
existing view and then clicking OK would cause gitk to go into an
infinite loop. The problem was that newviewok was invoking reloadcommits
via "run reloadcommits", but reloadcommits wasn't explicitly returning
0, and whatever it was returning was causing dorunq to run it over
and over again. This fixes it by making reloadcommits return 0.
Signed-off-by: Paul Mackerras <paulus@samba.org>
This makes gitk select the new commit when cherry-picking, and select
the new checked-out head when resetting or checking out a branch.
This feels more natural because the user is usually more interested
in that commit now than whatever was selected before.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Only Ctrl "=" was bound to increase the font size, probably because
English keyboards have the plus on the same key as the equal sign.
However, not the whole world is English, and at least with some
other keyboard layouts, Ctrl "+" did not work as documented.
Noticed by Stephan Hennig.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Instead of selecting the first commit that appears, this makes gitk
select the currently checked out head, if the user hasn't explicitly
selected some other commit by the time it appears. If the head hasn't
appeared by the time the graph is complete, then we select the first
real commit.
This applies both for graph updates and when the graph is being read
in initially.
Signed-off-by: Paul Mackerras <paulus@samba.org>
The make_disporder function has an optimization where it assumed that
if displayorder was already long enough and the first entry in it for
a particular arc was non-null, then the whole arc was present. This
turns out not to be true in some circumstances, since we can add a
commit to an arc (which truncates displayorder to the previous end of
that arc), then call make_disporder for later arcs (which will pad
displayorder with null elements), then call make_disporder for the
first arc - which won't update the null elements.
This fixes it by changing the optimization to check the last element
for the arc instead of the first.
Signed-off-by: Paul Mackerras <paulus@samba.org>
The po2msg.sh script and the .gitignore in the po directory have been
shamelessly copied from the current git-gui. This enables the top
level "make NO_MSGFMT" to work consistently for git across the git-gui
and gitk sub-projects.
This is the same effective patch that has previously been posted as a
git.git patch which more succinctly described the copying of
po/.gitignore and po/po2msg.sh from git-gui.
Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Despite the name, the --revs-only flag to git rev-parse doesn't make
it output only revision IDs. It makes it output only arguments that
are suitable for giving to git rev-list. So make start_rev_list and
updatecommits cope with arguments output by git rev-parse that aren't
revision IDs. This way we won't get an error when an argument such as
"-300" has been given to gitk and the view is updated.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Have the text fields in the view definition dialog (View->New view...)
use the background color as configured through the preferences, instead
of hard-coded 'white'.
This was suggested by Paul Wise through http://bugs.debian.org/457124
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This Makefile uses the template provided at git.git/gitk-git/Makefile
by Junio and adds the rules for the i18n files.
Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This means that we don't have to keep clearing them out whenever we
change the row numbers for some commits.
Signed-off-by: Paul Mackerras <paulus@samba.org>
The default options for panedwindows in Tk 8.5 make the sash
virtually invisible -- the handle is not shown and the relief is
flat. This puts the defaults back to showing the handle and a
raised relief on the sash, as in Tk 8.4.
This uses the option command to do this, and also uses the option
command to set the default font for various UI elements to the
UI font ("uifont").
Signed-off-by: Paul Mackerras <paulus@samba.org>
When a fake row is added, we add its (fake) ID to the children list
for its (fake) parent. If renumbervarc were to then renumber the
parent it would incorrectly use the fake child. This avoids the
problem by adding a last_real_child procedure which won't return
a fake ID, and using it in renumbervarc. For symmetry this also adds
a first_real_child procedure and uses it in ordertoken.
Signed-off-by: Paul Mackerras <paulus@samba.org>
First, findmore would sometimes get a Tcl error due to relying on
varcorder and vrownum having valid values for the rows being searched,
but they may not be valid unless update_arcrows is called, so this
makes findmore call update_arcrows if necessary.
Secondly, in the "touching paths" and "adding/removing string" modes,
findmore was treating fhighlights($row) == -1 as meaning the row
matches, whereas it only means that we haven't received an answer from
the external git diff-tree process about it yet. This fixes it.
Signed-off-by: Paul Mackerras <paulus@samba.org>
* Make sure targetrow is never >= numcommits
* Don't try to do anything about the target row if the targetid is
no longer in the view; it'll just cause Tcl errors
* In insertrow, increment targetrow if we are inserting the fake
commit at or before the target row
* In removerow, if we are removing the target row, make it the next
one instead.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Since commits come in out of order and get sorted as we see them,
we can have commits coming in and being placed before the commits
that are visible in the graph display pane. Previously we just
displayed a certain range of row numbers, meaning that when
incoming commits were placed before the displayed range, the
displayed commits were displaced downwards. This makes it so
that we keep the same set of commits displayed, unless the user
explicitly scrolls the pane, in which case it scrolls as expected.
We do this by having a "target" commit which we try to keep in the
same visible position. If commits have come in before it we scroll
the canvases by the number of rows that it has moved in the display
order.
This also fixes a bug in rowofcommit where it would test
cached_commitrow before possibly calling update_arcrows, which is
where cached_commitrow gets invalidated if things have changed.
Now we call update_arcrows if necessary first.
Signed-off-by: Paul Mackerras <paulus@samba.org>
When updating the display, if the checked-out head has moved on and
isn't currently shown, and there are local changes, we could try to
insert a fake row with a parent that isn't displayed, leading to a
Tcl error. This is because we check whether the checked-out head
is displayed before rereading the references (which is when we discover
that the head has moved). This fixes it.
Signed-off-by: Paul Mackerras <paulus@samba.org>
* Fixed a bug that occasionally resulted in Tcl "can't use empty string
as argument to incr" errors - rowofcommit was sometimes not calling
update_arcrows when it needed to.
* Fixed a "no such element in array" error when removing a fake row,
by unsetting currentid and selectedline in removerow if the row we
are removing is the currently selected row.
* Made the "update commits" function always do "reread references".
* Made dodiffindex et al. remove the fake row(s) if necessary.
* Fixed a bug where clicking on a row in the graph display pane didn't
account for horizontal scrolling of the pane.
* Started changing things that cached information based on row numbers
to use commit IDs instead -- this converts the "select line" items
that are put into the history list to use "select by ID" instead.
* Simplified redrawtags a bit, and fixed a bug where it would use the
mainfont for working out how far it extends to the right in the graph
display pane rather than the actual font (which might be bold).
* Fixed a bug where "reread references" wouldn't notice if the currently
checked-out head had changed.
Signed-off-by: Paul Mackerras <paulus@samba.org>
When using translations, the target language must be encoded in utf-8
because almost all target languages will contain non-ascii characters.
For that reason, the non-translated strings should be in utf-8 as well
so that there isn't any encoding mixup inside the program.
Signed-off-by: Paul Mackerras <paulus@samba.org>
This just marks up plain strings, that aren't used in any unusual way.
Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>