Differences between revisions 7 and 34 (spanning 27 versions)
Revision 7 as of 2006-05-10 15:46:29
Size: 2622
Editor: EricHopper
Comment:
Revision 34 as of 2009-06-29 05:31:04
Size: 5522
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Mercurial includes a tool called hgk that allows browsing the history of a repository in a GUI. It's a direct port of the gitk tool used with git. Hgk requires Tcl/Tk version 8.4 or later. ## page was renamed from UsingHgk
== Hgk extension ==
'''This extension is currently being distributed along with Mercurial.'''
Line 3: Line 5:
To use hgk, you'll want to install the hgk.py extension which adds a view command as well as
other interfaces that hgk uses to communicate with Mercurial in a git-like manner.
''Author: Chris Mason''
Line 6: Line 7:
Both hgk and hgk.py are found in the contrib directory. === Overview ===
The {{{hgk}}} extension allows browsing the history of a repository in a graphical way. It requires Tcl/Tk version 8.4 or later. (Tcl/Tk is not distributed with Mercurial.)
Line 8: Line 10:
To load an extension, you add it to your .hgrc file (you have to use your global $HOME/.hgrc file,
not one in a repository). You can specify an absolute path:
=== Configuration ===

<!> As of {{{be20a42f27a1}}} changeset (in 1.0 and later), Tcl {{{.gitk}}} configuration file was renamed to {{{.hgk}}} to help people working with both {{{gitk}}} and {{{hgk}}}.

{{{hgk}}} consists of two parts: a Tcl script that does the displaying and querying of information, and an extension to mercurial named {{{hgk.py}}}, which provides hooks for {{{hgk}}} to get information. {{{hgk}}} can be found in the {{{contrib}}} directory, and {{{hgk.py}}} can be found in the {{{hgext}}} directory.

To load the {{{hgk.py}}} extension, add it to your .hgrc file (you have to use your global $HOME/.hgrc file,
not one in a repository). You can specify an absolute path:
Line 23: Line 31:
You would also need to add hgk to your search path, or specify the path to hgk in your .hgrc file: The {{{hg view}}} command will launch the {{{hgk}}} Tcl script. For this command to work, {{{hgk}}} must be in your search path. Alternately, you can specify the path to {{{hgk}}} in your .hgrc file:
Line 30: Line 38:
<!> In version 0.7, this extension is named "hgit" (without the .py) and does not provide the view command. You must invoke hgk directly. <!> '''Note''': Many Linux distributions include the {{{hgk.py}}} extension in the mercurial package, but not the {{{hgk}}} Tcl script. If this is the case, you can find it in the contrib directory of the main Mercurial tar.gz from the download section. WARNING: if you fetch the contrib directory by hand, be careful to get the one that matches your version of Mercurial! Be aware that {{{hgk}}} requires {{{/usr/bin/wish}}} - which (at least on Fedora) is in the {{{tk}}} package.
Line 50: Line 58:
=== Configuration for Windows NT ===
Under Windows NT, we need to make sure Hg can invoke the hgk script. So, assuming you have Tcl/Tk installed (!ActiveTcl 8.4.15 works well with Mercurial 0.9.4), create a file called {{{hgk.cmd}}} with the following content (just replace the path to the hgk script on your system):
{{{
@set HG=C:\location\of\hg.exe
@wish C:\path\to\hgk %*
}}}

If you're using the latest version of !ActiveTcl (currently 8.5.4), you might need to change @wish to @wish85, and put quotes around the path to hgk as shown below:
{{{
@set HG=C:\location\of\hg.exe
@wish85 "C:\Program Files\path\to\hgk" %*
}}}

If using [[http://www.equi4.com/tclkit/|TclKit]], then instead of {{{@wish C:\path\to\hgk %*}}} use this line: {{{@"c:\path\to\tclkit-win32.exe" "c:\path\to\hgk" %*}}}

As with the Unix environment, you need to add {{{hgk.cmd}}} to the search path, or specify the path to hgk in your mercurial.ini file:

{{{
[hgk]
path=C:\location\of\hgk.cmd
}}}


Alternatively you can put the following in your Mercurial.ini file after installing !ActiveTcl
 (either the system-wide `<Mercurial install path>/Mercurial.ini` or specific-user `c:/Documents and Settings/<username>/Mercurial.ini`)
{{{
[extensions]
# enable hgk extension ('hg help' shows 'view' as a command)
hgk=

[hgk]
# Replace the following with your path to hgk
path="C:\Program Files\Mercurial\Contrib\hgk.tcl"
}}}

Windows users may be missing hgk which as per [[http://wiki.mozilla.org/Mercurial_on_Windows|Mozilla]] can be downloaded at:
http://hg.intevation.org/mercurial/crew/raw-file/b43db44cd047/contrib/hgk

To get the latest version, go to [[http://hg.intevation.org/mercurial/file/]] and navigate to contrib/hgk.

(You will need to rename the file to hgk.tcl)
Line 73: Line 122:

=== Notes ===
The {{{hgk}}} Tcl script is a direct port of the {{{gitk}}} tool used with git. The {{{hgk.py}}} extension allows {{{hgk}}} to interact with mercurial in a git-like manner.

Hgk extension

This extension is currently being distributed along with Mercurial.

Author: Chris Mason

Overview

The hgk extension allows browsing the history of a repository in a graphical way. It requires Tcl/Tk version 8.4 or later. (Tcl/Tk is not distributed with Mercurial.)

Configuration

<!> As of be20a42f27a1 changeset (in 1.0 and later), Tcl .gitk configuration file was renamed to .hgk to help people working with both gitk and hgk.

hgk consists of two parts: a Tcl script that does the displaying and querying of information, and an extension to mercurial named hgk.py, which provides hooks for hgk to get information. hgk can be found in the contrib directory, and hgk.py can be found in the hgext directory.

To load the hgk.py extension, add it to your .hgrc file (you have to use your global $HOME/.hgrc file, not one in a repository). You can specify an absolute path:

[extensions]
hgk=/usr/local/lib/hgk.py

Mercurial can also scan the default python library path for a file named 'hgk.py' if you set hgk empty:

[extensions]
hgk=

The hg view command will launch the hgk Tcl script. For this command to work, hgk must be in your search path. Alternately, you can specify the path to hgk in your .hgrc file:

[hgk]
path=/location/of/hgk

<!> Note: Many Linux distributions include the hgk.py extension in the mercurial package, but not the hgk Tcl script. If this is the case, you can find it in the contrib directory of the main Mercurial tar.gz from the download section. WARNING: if you fetch the contrib directory by hand, be careful to get the one that matches your version of Mercurial! Be aware that hgk requires /usr/bin/wish - which (at least on Fedora) is in the tk package.

Now hg help will show the new commands provided by the hgk extension:

$ hg help
...
 status      show changed files in the working directory
 tag         add a tag for the current tip or a given revision
 tags        list repository tags
 tip         show the tip revision
 unbundle    apply a changegroup file
 undo        undo the last commit or pull
 update      update or merge working directory
 verify      verify the integrity of the repository
 version     output version and copyright information
 view        start interactive history viewer
$ hg view

Configuration for Windows NT

Under Windows NT, we need to make sure Hg can invoke the hgk script. So, assuming you have Tcl/Tk installed (ActiveTcl 8.4.15 works well with Mercurial 0.9.4), create a file called hgk.cmd with the following content (just replace the path to the hgk script on your system):

@set HG=C:\location\of\hg.exe
@wish C:\path\to\hgk %*

If you're using the latest version of ActiveTcl (currently 8.5.4), you might need to change @wish to @wish85, and put quotes around the path to hgk as shown below:

@set HG=C:\location\of\hg.exe
@wish85 "C:\Program Files\path\to\hgk" %*

If using TclKit, then instead of @wish C:\path\to\hgk %* use this line: @"c:\path\to\tclkit-win32.exe" "c:\path\to\hgk" %*

As with the Unix environment, you need to add hgk.cmd to the search path, or specify the path to hgk in your mercurial.ini file:

[hgk]
path=C:\location\of\hgk.cmd

Alternatively you can put the following in your Mercurial.ini file after installing ActiveTcl

  • (either the system-wide <Mercurial install path>/Mercurial.ini or specific-user c:/Documents and Settings/<username>/Mercurial.ini)

[extensions]
# enable hgk extension ('hg help' shows 'view' as a command)
hgk=

[hgk]
# Replace the following with your path to hgk
path="C:\Program Files\Mercurial\Contrib\hgk.tcl"

Windows users may be missing hgk which as per Mozilla can be downloaded at: http://hg.intevation.org/mercurial/crew/raw-file/b43db44cd047/contrib/hgk

To get the latest version, go to http://hg.intevation.org/mercurial/file/ and navigate to contrib/hgk.

(You will need to rename the file to hgk.tcl)

Keyboard Accelerators

The following key combinations can be used to perform certain actions:

Ctrl+q                    quit
Ctrl+f                    find
Ctrl+= or Ctrl+<Keypad +> increase font size
Ctrl+- or Ctrl+<Keypad -> decrease font size
Ctrl+g, Return, or '/'    find next match
Ctrl+r or '?'             find previous match
Arrow-up                  select previous changeset
Arrow-down                select next changeset
Page-up or 'p'            scroll changeset list up one page
Page-down or 'n'          scroll changeset list down one page
Delete, Backspace or 'b'  scroll viewed changeset up one page
Space                     scroll viewed changeset down one page
'd'                       scroll viewed changeset down 18 lines
'u'                       scroll viewed changeset up 18 lines

Selected font size will be saved in ~/.gitk and reused in the next session.

Notes

The hgk Tcl script is a direct port of the gitk tool used with git. The hgk.py extension allows hgk to interact with mercurial in a git-like manner.


CategoryExtension

HgkExtension (last edited 2014-04-23 12:33:48 by MartinGeisler)