<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/lib, branch gitgui-0.7.1</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=gitgui-0.7.1</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=gitgui-0.7.1'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2007-05-09T04:48:27Z</updated>
<entry>
<title>git-gui: Format author/committer times in ISO format</title>
<updated>2007-05-09T04:48:27Z</updated>
<author>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
</author>
<published>2007-05-09T04:48:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=76486bbefbaeb606f662dadde0ca5dac59a4ec31'/>
<id>urn:sha1:76486bbefbaeb606f662dadde0ca5dac59a4ec31</id>
<content type='text'>
This is a simple change to match what gitk does when it shows
a commit; we format using ISO dates (yyyy-mm-dd HH:MM:SS).

Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;</content>
</entry>
<entry>
<title>git-gui: Cleanup minor nits in blame code</title>
<updated>2007-05-09T04:36:25Z</updated>
<author>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
</author>
<published>2007-05-09T04:36:25Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=0511798f06d3456885682605b54bd3bc378e8fda'/>
<id>urn:sha1:0511798f06d3456885682605b54bd3bc378e8fda</id>
<content type='text'>
We can use [list ...] rather than "", especially when we are talking
about values as then they are properly escaped if necessary.  Small
nit, but probably not a huge deal as the only data being inlined here
is Tk paths.

Some of the lines in the parser code were longer than 80 characters
wide, and they actually were all the same value on the end part of
the line.  Rather than keeping the mess copied-and-pasted around we
can set the last argument into a local variable and reuse it many
times.

The commit display code was also rather difficult to read on an 80
character wide terminal, so I'm moving it all into a double quoted
string that is easier to read.

Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;</content>
</entry>
<entry>
<title>git-gui: Generate blame on uncommitted working tree file</title>
<updated>2007-05-09T02:48:47Z</updated>
<author>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
</author>
<published>2007-05-09T02:48:47Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=a0db0d61fbc447f13cb0aadf01c83eb193b22dc9'/>
<id>urn:sha1:a0db0d61fbc447f13cb0aadf01c83eb193b22dc9</id>
<content type='text'>
If the user doesn't give us a revision parameter to our blame
subcommand then we can generate blame against the working tree
file by passing the file path off to blame with the --contents
argument.  In this case we cannot obtain the contents of the
file from the ODB; instead we must obtain the contents by
reading the working directory file as-is.

Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;</content>
</entry>
<entry>
<title>git-gui: Convert blame to the "class" way of doing things</title>
<updated>2007-05-09T01:38:55Z</updated>
<author>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
</author>
<published>2007-05-09T01:33:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=685caf9af672811b45ebeaaa299b8f9fbd743d82'/>
<id>urn:sha1:685caf9af672811b45ebeaaa299b8f9fbd743d82</id>
<content type='text'>
Our blame viewer code has historically been a mess simply
because the data for multiple viewers was all crammed into
a single pair of Tcl arrays.  This made the code hard to
read and even harder to maintain.

Now that we have a slightly better way of tracking the data
for our "meta-widgets" we can make use of it here in the
blame viewer to cleanup the code and make it easier to work
with long term.

Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>git-gui: Don't attempt to inline array reads in methods</title>
<updated>2007-05-09T01:38:54Z</updated>
<author>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
</author>
<published>2007-05-09T01:31:31Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=28bf928cf81eec720bc8a31179a0c9cf688d5af3'/>
<id>urn:sha1:28bf928cf81eec720bc8a31179a0c9cf688d5af3</id>
<content type='text'>
If a variable reference to a field is to an array, and it is
the only reference to that field in that method we cannot make
it an inlined [set foo] call as the regexp was converting the
Tcl code wrong.  We were producing "[set foo](x)" for "$foo(x)",
and that isn't valid Tcl when foo is an array.  So we just punt
if the only occurance has a ( after it.

Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>git-gui: Convert browser, console to "class" format</title>
<updated>2007-05-09T01:38:54Z</updated>
<author>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
</author>
<published>2007-05-09T00:33:47Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=c74b6c66f00ce51b2c01d20fc5ef0e6429811124'/>
<id>urn:sha1:c74b6c66f00ce51b2c01d20fc5ef0e6429811124</id>
<content type='text'>
Now that we have a slightly easier method of working with per-widget
data we should make use of that technique in our browser and console
meta-widgets, as both have a decent amount of information that they
store on a per-widget basis and our current approach of handling
it is difficult to follow.

Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>git-gui: Define a simple class/method system</title>
<updated>2007-05-09T01:38:54Z</updated>
<author>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
</author>
<published>2007-05-08T23:54:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=1f07c4e5cefec88d825045ade24eee71f6a2df47'/>
<id>urn:sha1:1f07c4e5cefec88d825045ade24eee71f6a2df47</id>
<content type='text'>
As most of the git-gui interface is based upon "meta-widgets"
that need to carry around a good deal of state (e.g. console
windows, browser windows, blame viewer) we have a good deal
of messy code that tries to store this meta-widget state in
global arrays, where keys into the array are formed from a
union of a unique "object instance id" and the field name.

This is a simple class system for Tcl that allows us to
hide much of that mess by making Tcl do what it does best;
process strings to manipulate its own code during startup.

Each object instance is placed into its own namespace.  The
namespace is created when the object instance is created and
the namespace is destroyed when the object instance is removed
from the system.  Within that namespace we place variables for
each field within the class; these variables can themselves be
scalar values or full-blown Tcl arrays.

A simple class might be defined as:

  class map {
    field data
    field size 0

    constructor {} {
      return $this
    }
    method set {name value} {
      set data($name) $value
      incr size
    }
    method size {} {
      return $size
    } ifdeleted { return 0 }
  }

All fields must be declared before any constructors or methods.  This
allows our class to generate a list of the fields so it can properly
alter the definition of the constructor and method bodies prior to
passing them off to Tcl for definition with proc. A field may optionally
be given a default/initial value.  This can only be done for non-array
type fields.

Constructors are given full access to all fields of the class, so they
can initialize the data values.  The default values of fields (if any)
are set before the constructor runs, and the implicit local variable
$this is initialized to the instance identifier.

Methods are given access to fields they actually use in their body.
Every method has an implicit "this" argument inserted as its first
parameter; callers of methods must be sure they supply this value.

Some basic optimization tricks are performed (but not much).  We
try to only upvar (locally bind) fields that are accessed within a
method, but we err on the side of caution and may upvar more than
we need to.  If a variable is accessed only once within a method
and that access is by $foo (read) we avoid the upvar and instead
use [set foo] to obtain the value.  This is slightly faster as Tcl
does not need to lookup the variable twice.

We also offer some small syntatic sugar for interacting with Tk and
the fileevent callback system in Tcl.  If a field (say "foo") is used
as "@foo" we insert instead the true global variable name of that
variable into the body of the constructor or method.  This allows easy
binding to Tk textvariable options, e.g.:

  label $w.title -textvariable @title

Proper namespace callbacks can also be setup with the special cb proc
that is defined in each namespace.  [cb _foo a] will invoke the method
_foo in the current namespace, passing it $this as the first (implied)
parameter and a as the second parameter.  This makes it very simple to
connect an object instance to a -command option for a Tk widget or to
a fileevent readable or writable for a file channel.

Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>git-gui: Allow shift-{k,j} to select a range of branches to merge</title>
<updated>2007-05-09T01:38:46Z</updated>
<author>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
</author>
<published>2007-05-09T01:38:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=cc1f83fbdff1ae248c91ab231ab4100351e1ba0a'/>
<id>urn:sha1:cc1f83fbdff1ae248c91ab231ab4100351e1ba0a</id>
<content type='text'>
I found it useful to be able to use j/k (vi-like keys) to move
up and down the list of branches to merge and shift-j/k to do
the selection, much as shift-up/down (arrow keys) would alter
the selection.

Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;</content>
</entry>
<entry>
<title>git-gui: Use vi-like keys in merge dialog</title>
<updated>2007-05-08T03:35:53Z</updated>
<author>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
</author>
<published>2007-05-05T06:28:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=ebcaadabcb90eaf35a3bd69a50cccce4be4dcc2c'/>
<id>urn:sha1:ebcaadabcb90eaf35a3bd69a50cccce4be4dcc2c</id>
<content type='text'>
Since we support vi-like keys for scrolling in other UI contexts
we can easily do so here too.  Tk's handy little `event generate'
makes this a lot easier than I thought it would be.  We may want
to go back and fix some of the other vi-like bindings to redirect
to the arrow and pageup/pagedown keys, rather than running the
view changes directly.

I've bound 'v' to visualize, as this is a somewhat common thing
to want to do in the merge dialog.  Control (or Command) Return
is also bound to start the merge, much as it is bound in the
main window to activate the commit.

Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>git-gui: Include commit id/subject in merge choices</title>
<updated>2007-05-08T03:35:52Z</updated>
<author>
<name>Shawn O. Pearce</name>
<email>spearce@spearce.org</email>
</author>
<published>2007-05-03T22:21:39Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=1fc4ba86f80c1365943abac54679dd1924a6737b'/>
<id>urn:sha1:1fc4ba86f80c1365943abac54679dd1924a6737b</id>
<content type='text'>
When merging branches using our local merge feature it can be
handy to know the first few digits of the commit the ref points
at as well as the short description of the branch name.

Unfortunately I'm unable to use three listboxes in a row, as Tcl
freaks out and refuses to let me have a selection in more than
one of them at any given point in time.  So instead we use a
fixed width font in the existing listbox and organize the data
into three columns.  Not nearly as nice looking, but users can
continue to use the listbox's features.

Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
</feed>
