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>
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>
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>
By setting the environment variable GITK_MSGSDIR, one can manually set
the directory where the .msg files are located. This is quite handy
during development with GITK_MSGSDIR=po.
Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
The compiled .msg files will be installed into $(sharedir)/gitk/lib/msgs
according to Junio's mailing list proposal on 2007-07-28.
Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This restores date mode, which lists commits by date, as far as possible
given the constraint that parents come after all their children. To
implement this in the new framework, we (1) only join a new commit onto
an existing arc if the arc is the last arc created, (2) treat arcs as
seeds unless they have a child arc that comes later, and (3) never
decrease the token value for an arc.
This means we get lots of "seeds", which exposed some quadratic behaviour
in adding and removing seeds. To fix this, we add a vbackptr array, which
points to the arc whose vleftptr entry points to us, and a vlastins array,
which shows where in an arc's vdownptr/vleftptr list we last inserted a
parent, which acts as a hint of a good place to start looking for where to
insert a new child.
This also ensures the children array elements stay in sorted order at all
times. We weren't resorting the children lists when reassigning tokens
in renumbervarc. Since the children lists are now always sorted, we don't
have to search through all elements to find the one with the highest token;
we can just use the last element.
Signed-off-by: Paul Mackerras <paulus@samba.org>
* Add/remove fake commits (for local changes) when updating the view
even if nothing else has changed.
* Get rid of unused getdbg variable.
* Get rid of vseeds and uat.
* Fix bug where removerow would throw a "no such element in array" error.
* Clear out cached highlights when line numbers change.
* Make dodiffindex remove the fake commit rows if they currently exist
but there are now no local changes.
Signed-off-by: Paul Mackerras <paulus@samba.org>
First, update_arcrows was being overly aggressive in trimming
displayorder, resulting in calls to rowofcommit sometimes trimming off
commits that layoutrows had asked for in make_disporder and was relying
on having present. This adds a vrowmod($view) variable that lets
update_arcrows be more precise in trimming off the invalid bits of
displayorder (and it also simplifies the check in make_disporder).
This modifies modify_arc and its callers so that vrowmod($view) is
updated appropriately.
Secondly, we were sometimes calling idcol with $i==-1, which resulted
in a call to ordertoken with the null string. This fixes it by
forcing $i to 0 if it is less than zero.
This also fixes a possible infinite recursion with rowofcommit and
update_arcrows calling each other ad infinitum.
Signed-off-by: Paul Mackerras <paulus@samba.org>
First, if we invalidate the layout for all rows (i.e. from row 0 on),
we were calling undolayout with an empty string as the argument.
Second, the comparison in make_disporder that tests if we need to
call update_arcrows was the wrong way around.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Instead of computing ordertok values and arc row numbers in
getcommitlines, this defers computing them until they are needed.
So getcommitlines no longer calls update_arcrows; instead it gets
called from rowofcommit and make_disporder. Things that modify arcs
now call modify_arc instead of setting vtokmod/varcmod directly,
and modify_arc does the undolayout that used to be in update_arcrows.
Also, idcol and make_idlist now use a new ordertoken function instead
of the ordertok variable. ordertoken uses ordertok as a cache, but
can itself compute the ordering tokens from scratch. This means that
the ordering tokens (and hence the layout of the graph) is once again
determined by the topological ordering we put on the graph, not on the
order in which we see the commits from git log, which improves the
appearance of the graph.
Signed-off-by: Paul Mackerras <paulus@samba.org>
If the user specified multiple revisions arguments on the command
line or for a view, we were passing the whole list of arguments to
git rev-parse as a single argument, and thus git rev-parse didn't
interpret it as revisions. This fixes it by adding an eval so the
arguments get passed to git rev-parse as separate arguments.
Signed-off-by: Paul Mackerras <paulus@samba.org>
We weren't setting vtokmod and varcmod in renumbervarc, so after a
call to renumbervarc we sometimes weren't reassigning row numbers to
all the arcs whose row numbers had changed. This fixes it.
This also collapses layoutmore and showstuff into one procedure and
gets rid of the phase variable.
Signed-off-by: Paul Mackerras <paulus@samba.org>
This very large patch implements code to organize the commits from
git log into "arcs" (sequences of commits where each pair of adjacent
commits are the only parent and child of each other), and orders the
arcs so as to get a topological ordering of the commits. This means
we can use git log without --topo-order and display the commits as we
get them, incrementally, which makes the cold-cache start up time much
faster, particularly on unpacked repos.
One beneficial effect of this is that the File->Update menu item now
just adds any new commits to the existing graph instead of rereading
the whole thing from scratch, which is much faster. (If you do want
to reread the whole graph from scratch you can use File->Reload.)
At an implementation level, this means that the displayorder and
parentlist lists are no longer fully valid at all times, and the
commitrow array has gone. New procedures commitinview and commitonrow
replace the commitrow array, and make_disporder ensures that
displayorder and parentlist are valid for a range of rows.
The overall time to load the kernel repository has gone up a bit, from
~9 seconds to ~11 seconds on my G5, but I think that is worth it given
that the time to get a window up with commits displayed in it has gone
from ~3 seconds to under 1 second.
Signed-off-by: Paul Mackerras <paulus@samba.org>
This makes the radio buttons for selecting whether to see the full diff,
the old version or the new version use the same font as the other user
interface elements.
Signed-off-by: Paul Mackerras <paulus@samba.org>
This unifies findmore and findmorerev, and adds the ability to do
a search with or without wrap around from the end of the list of
commits to the beginning (or vice versa for reverse searches).
findnext and findprev are gone, and the buttons and keys for searching
all call dofind now. dofind doesn't unmark the matches to start with.
Shift-up and shift-down are back by popular request, and the searches
they do don't wrap around. The other keys that do searches (/, ?,
return, M-f) do wrapping searches except for M-g.
Signed-off-by: Paul Mackerras <paulus@samba.org>
First, paths ending in a slash were not matching anything. This fixes
path_filter to handle paths ending in a slash (such entries have to
match a directory, and can't match a file, e.g., foo/bar/ can't match
a plain file called foo/bar).
Secondly, clicking in the file list pane (bottom right) was broken
because $treediffs($ids) contained all the files modified by the
commit, not just those within the file list. This fixes that too.
Signed-off-by: Paul Mackerras <paulus@samba.org>
First, we weren't putting "--" between the ids and the paths in the
git diff-tree/diff-index/diff-files command, so if there was a tag
and a file with the same name, we could get an ambiguity in the
command. This puts the "--" in to make it clear that the paths are
paths.
Secondly, this implements the path limiting for merge diffs as well
as the normal 2-way diffs.
Signed-off-by: Paul Mackerras <paulus@samba.org>
This sets the status window when reading commits, searching through
commits, cherry-picking or checking out a head.
Signed-off-by: Paul Mackerras <paulus@samba.org>
This makes the reset function use a progress bar in the same location
as the progress bars for reading in commits and for finding commits,
instead of a progress bar in a separate detached window. The progress
bar for resetting is red.
This also puts "Resetting" in the status window while the reset is in
progress. The setting of the status window is done through an
extension of the interface used for setting the watch cursor.
Signed-off-by: Paul Mackerras <paulus@samba.org>
We weren't restoring the tabstop setting if the user pressed the
Cancel button in the Edit/Preferences window. Also improved the
label for the checkbox (made it "Tab spacing" rather than the laconic
"tabstop") and moved it above the "Display nearby tags" checkbox.
Signed-off-by: Paul Mackerras <paulus@samba.org>
When the user has specified a list of paths, either on the command line
or when creating a view, gitk currently displays the diffs for all files
that a commit has modified, not just the ones that match the path list.
This is different from other git commands such as git log. This change
makes gitk behave the same as these other git commands by default, that
is, gitk only displays the diffs for files that match the path list.
There is now a checkbox labelled "Limit diffs to listed paths" in the
Edit/Preferences pane. If that is unchecked, gitk will display the
diffs for all files as before.
When gitk is run with the --merge flag, it will get the list of unmerged
files at startup, intersect that with the paths listed on the command line
(if any), and use that as the list of paths.
Signed-off-by: Paul Mackerras <paulus@samba.org>
This fixes the error reported by Michele Ballabio, where gitk will
throw a Tcl error "can't unset prevlines(...)" when displaying a
commit that has a parent commit listed more than once, and the commit
is the first child of that parent.
The problem was basically that we had two variables, prevlines and
lineends, and were relying on the invariant that prevlines($id) was
set iff $id was in the lineends($r) list for some $r. But having
a duplicate parent breaks that invariant since we end up with the
parent listed twice in lineends.
This fixes it by simplifying the logic to use only a single variable,
lineend. It also rearranges things a little so that we don't try to
draw the line for the duplicated parent twice.
Signed-off-by: Paul Mackerras <paulus@samba.org>
This fixes an error reported by Adam Piątyszek: if the current HEAD
is not in the graph that gitk knows about when we do a cherry-pick
using gitk, then gitk hits an error when trying to update its
internal representation of the topology. This avoids the error by
not doing that update if the HEAD before the cherry-pick was a
commit that gitk doesn't know about.
Signed-off-by: Paul Mackerras <paulus@samba.org>
This checks that we have Tcl/Tk 8.4 or later, and puts up an error
message in a window and quits if not.
This was prompted by a patch submitted by Steffen Prohaska, but is
done a bit differently (this uses package require rather than
looking at [info tclversion], and uses show_error to display the
error rather than printing it to stderr).
Signed-off-by: Paul Mackerras <paulus@samba.org>
A file copy would be detected only if the original file was modified in the
same commit. This implies that there will be a patch listed under the
original file name, and we would expect that clicking the original file
name in the file list warps the patch window to that file's patch. (If the
original file was not modified, the copy would not be detected in the first
place, the copied file would be listed as "new file", and this whole matter
would not apply.)
However, if the name of the copy is sorted after the original file's patch,
then the logic introduced by commit d1cb298b0b (which picks up the link
information from the "copy from" line) would overwrite the link
information that is already present for the original file name, which was
parsed earlier. Hence, this patch reverts part of said commit.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
(Väinö Järvelä supplied this patch a while ago for 1.5.2. It no longer
applied cleanly, so I'm reposting it.)
MacBook doesn't seem to recognize MouseRelease-4 and -5 events, at all.
So i added a support for the MouseWheel event, which i limited to Tcl/tk
aqua, as i couldn't test it neither on Linux or Windows. Tcl/tk needs to
be updated from the version that is shipped with OS X 10.4 Tiger, for
this patch to work.
Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>