Commit graph

612 commits

Author SHA1 Message Date
Michele Ballabio c8c4854bec git-gui: add some strings to translation
Most of these changes were suggested by Shawn Pearce in an answer
to Johannes Schindelin.

Some strings for the blame module were added too.

[sp: Minor edits in blame module formatting]

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-13 20:43:26 -04:00
Shawn O. Pearce 4baba57f8d Merge branch 'maint'
* maint:
  git-gui: Paper bag fix "Commit->Revert" format arguments
  git-gui: Provide 'uninstall' Makefile target to undo an installation
  git-gui: Font chooser to handle a large number of font families
2007-09-13 20:13:59 -04:00
Shawn O. Pearce 55bad4f096 git-gui: Paper bag fix "Commit->Revert" format arguments
The recent bug fix to correctly handle filenames with %s (or any
other valid Tcl format specifier) missed a \ on this line and
caused the remaining format arguments to not be supplied when we
updated the status bar.  This caused a Tcl error anytime the user
was trying to perform a file revert.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-13 20:08:53 -04:00
Shawn O. Pearce 042f53c569 git-gui: Provide 'uninstall' Makefile target to undo an installation
Several users have requested a "make uninstall" target be provided
in the stock git-gui Makefile so that they can undo an install
if git-gui goes to the wrong place during the initial install,
or if they are unhappy with the tool and want to remove it from
their system.

We currently assume that the complete set of files we need to delete
are those defined by our Makefile and current source directory.
This could differ from what the user actually has installed if they
installed one version then attempt to use another to perform the
uninstall.  Right now I'm just going to say that is "pilot error".
Users should uninstall git-gui using the same version of source
that they used to make the installation.  Perhaps in the future we
could read tclIndex and base our uninstall decisions on its contents.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-13 20:02:39 -04:00
Shawn O. Pearce 5a534788eb Merge branch 'maint'
* maint:
  git-gui: Make backporting changes from i18n version easier
2007-09-13 19:19:42 -04:00
Shawn O. Pearce afe2098ddd git-gui: Font chooser to handle a large number of font families
Simon Sasburg noticed that on X11 if there are more fonts than can
fit in the height of the screen Tk's native tk_optionMenu does not
offer scroll arrows to the user and it is not possible to review
all choices or to select those that are off-screen.  On Mac OS X
the tk_optionMenu works properly but is awkward to navigate if the
list is long.

This is a rewrite of our font selection by providing a new modal
dialog that the user can launch from the git-gui Options panel.
The dialog offers the user a scrolling list of fonts in a pane.
An example text shows the user what the font looks like at the size
they have selected.  But I have to admit the example pane is less
than ideal.  For example in the case of our diff font we really
should show the user an example diff complete with our native diff
syntax coloring.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Acked-by: Simon Sasburg <simon.sasburg@gmail.com>
2007-09-13 19:07:46 -04:00
Shawn O. Pearce e7034d66ec git-gui: Make backporting changes from i18n version easier
This is a very trivial hack to define a global mc procedure that
does not actually perform i18n translations on its input strings.
By declaring an mc procedure here in our maint version of git-gui
we can take patches that are intended for the latest development
version of git-gui and easily backport them without needing to
tweak the mc calls first.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-13 19:04:14 -04:00
Shawn O. Pearce 262360f3aa git-gui: Document the new i18n context support
Translators working on po files will likely need to know what the
@@noun and @@verb parts are in the original message text, and why
these are different messages in the po files.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-12 17:05:16 -04:00
Harri Ilari Tapio Liusvaara a9813cb51d git-gui: Disambiguate "commit"
Commit is used as both verb and noun. While these happen to be
the same in some languages, they are not the same in all
languages, so disambiguate them using context-sensitive i18n.

Signed-off-by: Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-12 16:51:54 -04:00
Shawn O. Pearce 146d73a365 git-gui: Support context-sensitive i18n
Ocassionally, one would want to translate the same string used in
different contexts in diffrent ways. This patch provides a wrapper
for msgcat::mc that trims "@@" and anything coming after it, whether
or not the string actually got translated.

Proposed-by: Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-12 16:47:06 -04:00
Shawn O. Pearce c8dd7f62e8 Merge branch 'maint'
* maint:
  git-gui: Don't delete send on Windows as it doesn't exist
2007-09-11 18:57:26 -04:00
Shawn O. Pearce 63c4024ff0 git-gui: Don't delete send on Windows as it doesn't exist
The Windows port of Tk does not have the send command so we
cannot delete it from our global namespace, but the Mac OS
X and X11 ports do have it.  Switching this delete attempt
into a catch makes send go away, or stay away.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-11 18:57:18 -04:00
Shawn O. Pearce 66c75a5c9f git-gui: Localize commit/author dates when displaying them
Currently the Git plumbing is not localized so it does not know how
to output weekday and month names that conform to the user's locale
preferences.  This doesn't fit with the rest of git-gui's UI as some
of our dates are formatted in Tcl and some are just read from the Git
plumbing so dates aren't consistently presented.

Since git-for-each-ref is presenting us formatted dates and it offers
no way to change that setting even in git 1.5.3.1 we need to first do
a parse of the text strings it produces, correct for timezones, then
reformat the timestamp using Tcl's formatting routines.

Not exactly what I wanted to do but it gets us consistently presented
date strings in areas like the blame viewer and the revision picker
mega-widget's tooltips.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-10 01:54:16 -04:00
Shawn O. Pearce 93716a62c0 git-gui: Mark revision chooser tooltip for translation
Someone on #git today pointed out that the revision chooser's tooltips
are were being drawn with untranslated strings for the fixed labels we
include, such as "updated", "commit" and "remote".  These strings are
now passed through mc to allow them to be localized.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-10 00:40:46 -04:00
Shawn O. Pearce 5f51ccd259 Merge branch 'maint'
* maint:
  git-gui: Trim trailing slashes from untracked submodule names
  git-gui: Assume untracked directories are Git submodules
  git-gui: handle "deleted symlink" diff marker
  git-gui: show unstaged symlinks in diff viewer
2007-09-09 21:02:57 -04:00
Shawn O. Pearce 8938410189 git-gui: Trim trailing slashes from untracked submodule names
Oddly enough `git ls-files --others` supplies us the name of an
untracked submodule by including the trailing slash but that
same git version will not accept the name with a trailing slash
through `git update-index --stdin`.  Stripping off that final
slash character before loading it into our file lists allows
git-gui to stage changes to submodules just like any other file.

This change should give git-gui users some basic submodule support,
but it is strictly at the plumbing level as we do not actually know
about calling the git-submodule porcelain that is a recent addition
to git 1.5.3.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-09 20:39:47 -04:00
Shawn O. Pearce 3b9dfde3d6 git-gui: Assume untracked directories are Git submodules
If `git ls-files --others` returned us the name of a directory then
it is because Git has decided that this directory itself contains a
valid Git repository and its files shouldn't be listed as untracked
for this repository.

In such a case we should label the object as a Git repository and
not just as a directory.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-09 20:39:42 -04:00
Michele Ballabio 4ed1a190d0 git-gui: handle "deleted symlink" diff marker
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-09 19:47:26 -04:00
Michele Ballabio 2d19f8e921 git-gui: show unstaged symlinks in diff viewer
git-gui has a minor problem with regards to symlinks that point
to directories.

	git init
	mkdir realdir
	ln -s realdir linkdir
	git gui

Now clicking on file names in the "unstaged changes" window,
there's a problem coming from the "linkdir" symlink: git-gui
complains with

	error reading "file4": illegal operation on a directory

...even though git-gui can add that same symlink to the index just
fine.

This patch fix this by adding a check.

[sp: Minor fix to use {link} instead of "link" in condition
     and to only open the path if it is not a symlink.]

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-09 19:47:22 -04:00
Shawn O. Pearce b2bd31006f Merge branch 'maint'
* maint:
  git-gui: Avoid use of libdir in Makefile
  git-gui: Disable Tk send in all git-gui sessions
  git-gui: lib/index.tcl: handle files with % in the filename properly
2007-09-09 05:04:43 -04:00
Shawn O. Pearce c63fe3b2dc git-gui: Avoid use of libdir in Makefile
Dmitry V. Levin pointed out that on GNU linux libdir is often used
in Makefiles to mean "/usr/lib" or "/usr/lib64", a directory that
is meant to hold platform-specific binary files.  Using a different
libdir meaning here in git-gui's Makefile breaks idomatic expressions
like rpm specifile "make libdir=%_libdir".

Originally I asked that the git.git Makefile undefine libdir before
it calls git-gui's own Makefile but it turns out this is very hard
to do, if not impossible.  Renaming our libdir to gg_libdir resolves
this case with a minimum amount of fuss on our part.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-09 05:03:12 -04:00
Shawn O. Pearce cff93397ab git-gui: Disable Tk send in all git-gui sessions
The Tk designers blessed us with the "send" command, which on X11
will allow anyone who can connect to your X server to evaluate any
Tcl code they desire within any running Tk process.  This is just
plain nuts.  If git-gui wants someone running Tcl code within it
then would ask someone to supply that Tcl code to it; waiting for
someone to drop any random Tcl code into us is not fantastic idea.

By renaming send to the empty name the procedure will be removed
from the global namespace and Tk will stop responding to random Tcl
evaluation requests sent through the X server.  Since there is no
facility to filter these requests it is unlikely that we will ever
consider enabling this command.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-08 23:47:10 -04:00
Gerrit Pape 0b883ab30c git-gui: lib/index.tcl: handle files with % in the filename properly
Steps to reproduce the bug:

 $ mkdir repo && cd repo && git init
 Initialized empty Git repository in .git/
 $ touch 'foo%3Fsuite'
 $ git-gui

Then click on the 'foo%3Fsuite' icon to include it in a changeset, a
popup comes with:
'Error: bad field specifier "F"'

Vincent Danjean noticed the problem and also suggested the fix, reported
through
 http://bugs.debian.org/441167

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-08 23:06:26 -04:00
Shawn O. Pearce 4b08aa3fef Merge branch 'maint'
* maint:
  git-gui: Properly set the state of "Stage/Unstage Hunk" action
  git-gui: Fix detaching current branch during checkout
  git-gui: Correct starting of git-remote to handle -w option

Conflicts:

	git-gui.sh
2007-09-03 23:07:59 -04:00
Shawn O. Pearce 12fb223326 git-gui: Ensure msgfmt failure stops GNU make
If we have a failure executing msgfmt (such as the process just
crashes no matter what arguments you supply it because its own
installation is borked) we should stop the build process rather
than letting it continue along its merry way as if the .msg files
were created.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-03 23:04:54 -04:00
Shawn O. Pearce 047d94d505 git-gui: Properly set the state of "Stage/Unstage Hunk" action
Today I found yet another way for the "Stage Hunk" and "Unstage
Hunk" context menu actions to leave the wrong state enabled in
the UI.  The problem this time was that I connected the state
determination to the value of $::current_diff_side (the side the
diff is from).  When the user was last looking at a diff from the
index side and unstages everything the diff panel goes empty, but
the action stayed enabled as we always assumed unstaging was a
valid action.

This change moves the logic for determining when the action is
enabled away from the individual side selection, as they really
are two unrelated concepts.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-03 23:03:52 -04:00
Shawn O. Pearce 881d8f24ca git-gui: Fix detaching current branch during checkout
If the user tried to detach their HEAD while keeping the working
directory on the same commit we actually did not completely do
a detach operation internally.  The problem was caused by git-gui
not forcing the HEAD symbolic ref to be updated to a SHA-1 hash
when we were not switching revisions.  Now we update the HEAD ref
if we aren't currently detached or the hashes don't match.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-03 23:01:44 -04:00
Shawn O. Pearce 6e4ba05c7f git-gui: Correct starting of git-remote to handle -w option
Current versions of git-remote apparently are passing the -w option
to Perl as part of the shbang line:

  #!/usr/bin/perl -w

this caused a problem in git-gui and gave the user a Tcl error with
the message: "git-remote not supported: #!/usr/bin/perl -w".

The fix for this is to treat the shbang line as a Tcl list and look
at the first element only for guessing the executable name.  Once
we know the executable name we use the remaining elements (if any
exist) as arguments to the executable, before the script filename.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-03 23:01:44 -04:00
Michele Ballabio 74e528bf44 git-gui: remove dots in some UI strings
Dots in a UI string usually mean that a dialog box will
appear waiting for further input. So this patch removes
unneeded dots for actions that do not require user's
input.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-03 00:45:25 -04:00
Shawn O. Pearce 87b63de49c git-gui: Quiet the msgfmt part of the make process
I really prefer having a very short and sweet makefile output that
does not flood the user's screen with a ton of commands that they
don't care much about.  Traditionally git-gui has hidden away the
actual commands from output by the $(QUIET*) series of macros but
allow them to be seen with either `make QUIET=` or `make V=1`.

This change makes our i18n message generation process to be a lot
shorter and easier to digest at a glance:

  GITGUI_VERSION = 0.8.2.19.gb868-dirty
    * new locations or Tcl/Tk interpreter
    GEN git-gui
    BUILTIN git-citool
    INDEX lib/
    MSGFMT    po/de.msg 268 translated.
    MSGFMT    po/hu.msg 268 translated.
    MSGFMT    po/it.msg 268 translated.
    MSGFMT    po/ja.msg 268 translated.
    MSGFMT    po/ru.msg 249 translated, 12 fuzzy, 4 untranslated.
    MSGFMT po/zh_cn.msg 60 translated, 37 fuzzy, 168 untranslated.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-03 00:42:09 -04:00
Shawn O. Pearce b86882eda0 git-gui: Correct stock message for 'Invalid font specified in %s'
This particular message is talking about a specific option in the
configuration file named "gui.$name".  This option is not localized
so we cannot localize the "gui." that denotes the section the option
$name is found within.  Currently there are no plans to localize the
configuration options for git-gui, but if that were to change in the
future then it would be necessary to localize not only the "gui."
section prefix but also the $name (fontui and fontdiff).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-03 00:22:19 -04:00
Shawn O. Pearce 2ea2255507 git-gui: Update po/README as symlink process is not necessary
We don't actually need to create the lib/msgs symlink back to our
po directory in the source tree.  git-gui.sh is smart enough to
figure out this is where the msg files are and will load them from
the po directory if invoked as git-gui.sh.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-03 00:17:04 -04:00
Xudong Guan b4b093d110 git-gui: Added initial version of po/glossary/zh_cn.po
with contributions from LI Yang, WANG Cong, ZHANG Le, and rae l
from the zh-kernel.org mailing list.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:58:37 +01:00
Christian Stimming fcc73b7155 German glossary for translation
Signed-off-by: Christian Stimming <christian.stimming@ibeo-as.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:58:36 +01:00
Miklos Vajna f6b7de2acd Hungarian translation of git-gui
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:58:36 +01:00
Irina Riesen e2b7200fcd git-gui: initial version of russian translation
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Irina Riesen <irina.riesen@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:58:35 +01:00
Paolo Ciarrocchi 4fe7626488 Italian translation of git-gui
[jes: includes patches from Michele Ballabio]

Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:58:35 +01:00
しらいしななこ 2340a74e5f Japanese translation of git-gui
[jes: Also includes work from Junio Hamano]

Signed-off-by: しらいしななこ <nanako3@bluebottle.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:58:34 +01:00
Xudong Guan 377eaa0396 Initial Chinese translation for git-gui
Simplified Chinese, in UTF-8 encoding.

Signed-off-by: Xudong Guan <xudong.guan@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:58:34 +01:00
Christian Stimming 90a7149ff1 German translation for git-gui
Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:58:17 +01:00
Christian Stimming 3b703b2a38 Add glossary translation template into git.
This way, it should be easier for new translators to actually find out
about the glossary.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:57:41 +01:00
Christian Stimming 660a68cf18 Add glossary that can be converted into a po file for each language.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:56:13 +01:00
Johannes Schindelin 9f1a80877a Ignore po/*.msg
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:56:13 +01:00
Johannes Schindelin e79bbfea9b Add po/git-gui.pot
Usually, generated files are not part of the tracked content in
a project.  However, translators may lack the tools to generate
git-gui.pot.  Besides, it is possible that a contributor does
not even check out the repository, but gets this file via gitweb.

Pointed out by Junio.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:56:00 +01:00
Junio C Hamano 2631a81b90 git-gui po/README: Guide to translators
This short note is to help a translation contributor to help us
localizing git-gui message files by covering the basics.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-02 16:55:18 +01:00
Christian Stimming 3845048064 Makefile rules for translation catalog generation and installation.
[jes: with fixes by the i18n team.]

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:55:16 +01:00
Christian Stimming 1ac17950e9 Mark strings for translation.
The procedure [mc ...] will translate the strings through msgcat.
Strings must be enclosed in quotes, not in braces, because otherwise
xgettext cannot extract them properly, although on the Tcl side both
delimiters would work fine.

[jes: I merged the later patches to that end.]

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-09-02 16:54:48 +01:00
Shawn O. Pearce d4b0ccd931 git-gui: Initialize Tcl's msgcat library for internationalization
Tcl's msgcat library and corresponding mc procedure can locate a
translated string for any user message, provided that it is first
given a directory where the *.msg files are located containing the
translations.

During installation we will place the translations in lib/msgs/,
so we need to inform msgcat of this location once we determine it
during startup.  Our source code tree however will store all of
the translations within the po/ directory, so we need to special
case this variant.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-01 22:22:42 -04:00
Shawn O. Pearce fc703c209d git-gui: Locate the library directory early during startup
To support a localized version of git-gui we need to locate the
library directory early so we can initialize Tcl's msgcat package
to load translated messages from.  This needs to occur before we
declare our git-version proc so that errors related to locating
git or assessing its version can be reported to the end-user in
their preferred language.  However we have to keep the library
loading until after git-version has been declared, otherwise we
will fail to start git-gui if we are using a fake tclIndex that
was generated by our Makefile.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-01 21:58:29 -04:00
Shawn O. Pearce c80d25dbce git-gui: Correct 'git gui blame' in a subdirectory
David Kastrup pointed out that the following sequence was not
working as we had intended:

  $ cd lib
  $ git gui blame console.tcl
  fatal: cannot stat path lib/console.tcl: No such file or directory

The problem here was we disabled the chdir to the root of the
working tree when we are running with a "bare allowed" feature
such as blame or browser, but we still kept the prefix we found via
`git rev-parse --show-prefix`.  This caused us to try and look for
the file "console.tcl" within the subdirectory but also include
the subdirectory's own path from the root of the working tree.
This is unlikely to succeed, unless the user just happened to have
a "lib/lib/console.tcl" file in the repository, in which case we
would produce the wrong result.

In the case of a bare repository we shouldn't get back a value from
`rev-parse --show-prefix`, so really $_prefix should only be set
to the non-empty string if we are in a working tree and we are in a
subdirectory of that working tree.  If this is true we really want
to always be at the top level of the working tree, as all paths are
accessed as though they were relative to the top of the working tree.
Converting $_prefix to a ../ sequence is a fairly simple approach
to moving up the requisite levels.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-24 23:15:50 -04:00