mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
Merge branch 'master' of git://repo.or.cz/alt-git
This commit is contained in:
@@ -4,18 +4,45 @@ GIT v1.5.3.6 Release Notes
|
||||
Fixes since v1.5.3.5
|
||||
--------------------
|
||||
|
||||
* git-cvsexportcommit handles root commits better;
|
||||
* git-cvsexportcommit handles root commits better.
|
||||
|
||||
* git-svn dcommit used to clobber when sending a series of
|
||||
patches;
|
||||
patches.
|
||||
|
||||
* git-svn dcommit failed after attempting to rebase when
|
||||
started with a dirty index; now it stops upfront.
|
||||
|
||||
* git-grep sometimes refused to work when your index was
|
||||
unmerged;
|
||||
unmerged.
|
||||
|
||||
* "git-grep -A1 -B2" acted as if it was told to run "git -A1 -B21".
|
||||
|
||||
* git-hash-object did not honor configuration variables, such as
|
||||
core.compression.
|
||||
|
||||
* git-index-pack choked on a huge pack on 32-bit machines, even when
|
||||
large file offsets are supported.
|
||||
|
||||
* atom feeds from git-web said "10" for the month of November.
|
||||
|
||||
* a memory leak in commit walker was plugged.
|
||||
|
||||
* When git-send-email inserted the original author's From:
|
||||
address in body, it did not mark the message with
|
||||
Content-type: as needed.
|
||||
|
||||
* git-revert and git-cherry-pick incorrectly refused to start
|
||||
when the work tree was dirty.
|
||||
|
||||
* git-clean did not honor core.excludesfile configuration.
|
||||
|
||||
* git-add mishandled ".gitignore" files when applying them to
|
||||
subdirectories.
|
||||
|
||||
* While importing a too branchy history, git-fastimport did not
|
||||
honor delta depth limit properly.
|
||||
|
||||
* Support for zlib implementations that lack ZLIB_VERNUM and definition
|
||||
of deflateBound() has been added.
|
||||
|
||||
* Quite a lot of documentation clarifications.
|
||||
|
||||
--
|
||||
exec >/var/tmp/1
|
||||
O=v1.5.3.5-32-gcb6c162
|
||||
echo O=`git describe refs/heads/maint`
|
||||
git shortlog --no-merges $O..refs/heads/maint
|
||||
|
||||
@@ -32,6 +32,11 @@ Updates since v1.5.3
|
||||
(read: safer than the usual one) after the user accumulates
|
||||
too many loose objects.
|
||||
|
||||
* You need to explicitly set clean.requireForce to "false" to allow
|
||||
git-clean without -f to do any damage (lack of the configuration
|
||||
variable used to mean "do not require", but we now use the safer
|
||||
default).
|
||||
|
||||
* git-push has been rewritten in C.
|
||||
|
||||
* git-push learned --dry-run option to show what would happen
|
||||
@@ -52,11 +57,39 @@ Updates since v1.5.3
|
||||
* git-lost-found was deprecated in favor of git-fsck's --lost-found
|
||||
option.
|
||||
|
||||
* "git log" learned --early-output option to help interactive
|
||||
GUI implementations.
|
||||
|
||||
* git-svnimport was removed in favor of git-svn.
|
||||
|
||||
* git-bisect learned "skip" action to mark untestable commits.
|
||||
|
||||
* rename detection diff family, while detecting exact matches,
|
||||
* git-format-patch learned "format.numbered" configuration variable
|
||||
to automatically turn --numbered option on when more than one
|
||||
commits are formatted.
|
||||
|
||||
* git-ls-files learned "--exclude-standard" to use the canned
|
||||
set of exclude files.
|
||||
|
||||
* git-rebase now detaches head during its operation, so after a
|
||||
successful "git rebase" operation, the reflog entry branch@{1}
|
||||
for the current branch points at the commit before the rebase
|
||||
was started.
|
||||
|
||||
* "git-tag -a -f existing" begins the editor session using the
|
||||
existing annotation message.
|
||||
|
||||
* "git cvsexportcommit" learned -w option to specify and switch
|
||||
to the CVS working directory.
|
||||
|
||||
* "git checkout" from a subdirectory learned to use "../path"
|
||||
to allow checking out a path outside the current directory
|
||||
without cd'ing up.
|
||||
|
||||
* Output processing for '--pretty=format:<user format>' has
|
||||
been optimized.
|
||||
|
||||
* Rename detection diff family, while detecting exact matches,
|
||||
has been greatly optimized.
|
||||
|
||||
* Example update and post-receive hooks have been improved.
|
||||
@@ -77,8 +110,15 @@ Fixes since v1.5.3
|
||||
All of the fixes in v1.5.3 maintenance series are included in
|
||||
this release, unless otherwise noted.
|
||||
|
||||
* git-svn talking with the SVN over http will correctly quote branch
|
||||
and project names.
|
||||
|
||||
* "git rev-list --objects A..B" choked when the lower boundary
|
||||
of the range involved a subproject. This fix is also queued
|
||||
for 'maint' (but not in there yet).
|
||||
|
||||
--
|
||||
exec >/var/tmp/1
|
||||
O=v1.5.3.5-618-g5d4138a
|
||||
O=v1.5.3.6-727-g5d3d1ca
|
||||
echo O=`git describe refs/heads/master`
|
||||
git shortlog --no-merges $O..refs/heads/master ^refs/heads/maint
|
||||
|
||||
@@ -226,13 +226,15 @@ core.compression::
|
||||
An integer -1..9, indicating a default compression level.
|
||||
-1 is the zlib default. 0 means no compression,
|
||||
and 1..9 are various speed/size tradeoffs, 9 being slowest.
|
||||
If set, this provides a default to other compression variables,
|
||||
such as 'core.loosecompression' and 'pack.compression'.
|
||||
|
||||
core.loosecompression::
|
||||
An integer -1..9, indicating the compression level for objects that
|
||||
are not in a pack file. -1 is the zlib default. 0 means no
|
||||
compression, and 1..9 are various speed/size tradeoffs, 9 being
|
||||
slowest. If not set, defaults to core.compression. If that is
|
||||
not set, defaults to 0 (best speed).
|
||||
not set, defaults to 1 (best speed).
|
||||
|
||||
core.packedGitWindowSize::
|
||||
Number of bytes of a pack file to map into memory in a
|
||||
@@ -648,7 +650,9 @@ pack.compression::
|
||||
in a pack file. -1 is the zlib default. 0 means no
|
||||
compression, and 1..9 are various speed/size tradeoffs, 9 being
|
||||
slowest. If not set, defaults to core.compression. If that is
|
||||
not set, defaults to -1.
|
||||
not set, defaults to -1, the zlib default, which is "a default
|
||||
compromise between speed and compression (currently equivalent
|
||||
to level 6)."
|
||||
|
||||
pack.deltaCacheSize::
|
||||
The maximum memory in bytes used for caching deltas in
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
// Please don't remove this comment as asciidoc behaves badly when
|
||||
// the first non-empty line is ifdef/ifndef. The symptom is that
|
||||
// without this comment the <git-diff-core> attribute conditionally
|
||||
// defined below ends up being defined unconditionally.
|
||||
// Last checked with asciidoc 7.0.2.
|
||||
|
||||
ifndef::git-format-patch[]
|
||||
ifndef::git-diff[]
|
||||
:git-diff-core: 1
|
||||
endif::git-diff[]
|
||||
endif::git-format-patch[]
|
||||
|
||||
ifdef::git-format-patch[]
|
||||
-p::
|
||||
Generate patch (see section on generating patches)
|
||||
Generate patches without diffstat.
|
||||
endif::git-format-patch[]
|
||||
|
||||
ifndef::git-format-patch[]
|
||||
-p::
|
||||
Generate patch (see section on generating patches).
|
||||
{git-diff? This is the default.}
|
||||
endif::git-format-patch[]
|
||||
|
||||
-u::
|
||||
Synonym for "-p".
|
||||
@@ -13,6 +33,7 @@
|
||||
|
||||
--raw::
|
||||
Generate the raw format.
|
||||
{git-diff-core? This is the default.}
|
||||
|
||||
--patch-with-raw::
|
||||
Synonym for "-p --raw".
|
||||
@@ -41,6 +62,7 @@
|
||||
|
||||
--patch-with-stat::
|
||||
Synonym for "-p --stat".
|
||||
{git-format-patch? This is the default.}
|
||||
|
||||
-z::
|
||||
NUL-line termination on output. This affects the --raw
|
||||
|
||||
@@ -130,6 +130,7 @@ OPTIONS
|
||||
for "host.xz:foo/.git"). Cloning into an existing directory
|
||||
is not allowed.
|
||||
|
||||
:git-clone: 1
|
||||
include::urls.txt[]
|
||||
|
||||
Examples
|
||||
|
||||
@@ -75,6 +75,7 @@ and the range notations ("<commit>..<commit>" and
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
:git-diff: 1
|
||||
include::diff-options.txt[]
|
||||
|
||||
<path>...::
|
||||
|
||||
@@ -66,6 +66,7 @@ reference.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
:git-format-patch: 1
|
||||
include::diff-options.txt[]
|
||||
|
||||
-<n>::
|
||||
|
||||
@@ -3,7 +3,7 @@ git-get-tar-commit-id(1)
|
||||
|
||||
NAME
|
||||
----
|
||||
git-get-tar-commit-id - Extract commit ID from an archive created using git-tar-tree
|
||||
git-get-tar-commit-id - Extract commit ID from an archive created using git-archive
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
@@ -19,7 +19,7 @@ runtime is not influenced by the size of <tarfile> very much.
|
||||
|
||||
If no commit ID is found, git-get-tar-commit-id quietly exists with a
|
||||
return code of 1. This can happen if <tarfile> had not been created
|
||||
using git-archive or if the <treeish> parameter of git-archive had been
|
||||
using git-archive or if the first parameter of git-archive had been
|
||||
a tree ID instead of a commit ID or tag.
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ SYNOPSIS
|
||||
[-x <pattern>|--exclude=<pattern>]
|
||||
[-X <file>|--exclude-from=<file>]
|
||||
[--exclude-per-directory=<file>]
|
||||
[--exclude-standard]
|
||||
[--error-unmatch] [--with-tree=<tree-ish>]
|
||||
[--full-name] [--abbrev] [--] [<file>]\*
|
||||
|
||||
@@ -77,6 +78,10 @@ OPTIONS
|
||||
read additional exclude patterns that apply only to the
|
||||
directory and its subdirectories in <file>.
|
||||
|
||||
--exclude-standard::
|
||||
Add the standard git exclusions: .git/info/exclude, .gitignore
|
||||
in each directory, and the user's global exclusion file.
|
||||
|
||||
--error-unmatch::
|
||||
If any <file> does not appear in the index, treat this as an
|
||||
error (return 1).
|
||||
|
||||
@@ -19,7 +19,7 @@ depending on the subcommand:
|
||||
git reflog expire [--dry-run] [--stale-fix] [--verbose]
|
||||
[--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...
|
||||
|
||||
git reflog [show] [log-options]
|
||||
git reflog [show] [log-options] [<ref>]
|
||||
|
||||
Reflog is a mechanism to record when the tip of branches are
|
||||
updated. This command is to manage the information recorded in it.
|
||||
@@ -32,9 +32,16 @@ directly by the end users -- instead, see gitlink:git-gc[1].
|
||||
|
||||
The subcommand "show" (which is also the default, in the absence of any
|
||||
subcommands) will take all the normal log options, and show the log of
|
||||
`HEAD`, which will cover all recent actions, including branch switches.
|
||||
It is basically an alias for 'git log -g --abbrev-commit
|
||||
--pretty=oneline', see gitlink:git-log[1].
|
||||
the reference provided in the command-line (or `HEAD`, by default).
|
||||
The reflog will cover all recent actions (HEAD reflog records branch switching
|
||||
as well). It is an alias for 'git log -g --abbrev-commit --pretty=oneline';
|
||||
see gitlink:git-log[1].
|
||||
|
||||
The reflog is useful in various git commands, to specify the old value
|
||||
of a reference. For example, `HEAD@\{2\}` means "where HEAD used to be
|
||||
two moves ago", `master@\{one.week.ago\}` means "where master used to
|
||||
point to one week ago", and so on. See gitlink:git-rev-parse[1] for
|
||||
more details.
|
||||
|
||||
|
||||
OPTIONS
|
||||
|
||||
@@ -101,7 +101,7 @@ $ git remote
|
||||
origin
|
||||
$ git branch -r
|
||||
origin/master
|
||||
$ git remote add linux-nfs git://linux-nfs.org/pub/nfs-2.6.git
|
||||
$ git remote add linux-nfs git://linux-nfs.org/pub/linux/nfs-2.6.git
|
||||
$ git remote
|
||||
linux-nfs
|
||||
origin
|
||||
|
||||
@@ -23,6 +23,13 @@ distinguish between them.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
--parseopt::
|
||||
Use `git-rev-parse` in option parsing mode (see PARSEOPT section below).
|
||||
|
||||
--keep-dash-dash::
|
||||
Only meaningful in `--parseopt` mode. Tells the option parser to echo
|
||||
out the first `--` met instead of skipping it.
|
||||
|
||||
--revs-only::
|
||||
Do not output flags and parameters not meant for
|
||||
`git-rev-list` command.
|
||||
@@ -288,10 +295,75 @@ Here are a handful examples:
|
||||
C^@ I J F
|
||||
F^! D G H D F
|
||||
|
||||
PARSEOPT
|
||||
--------
|
||||
|
||||
In `--parseopt` mode, `git-rev-parse` helps massaging options to bring to shell
|
||||
scripts the same facilities C builtins have. It works as an option normalizer
|
||||
(e.g. splits single switches aggregate values), a bit like `getopt(1)` does.
|
||||
|
||||
It takes on the standard input the specification of the options to parse and
|
||||
understand, and echoes on the standard output a line suitable for `sh(1)` `eval`
|
||||
to replace the arguments with normalized ones. In case of error, it outputs
|
||||
usage on the standard error stream, and exits with code 129.
|
||||
|
||||
Input Format
|
||||
~~~~~~~~~~~~
|
||||
|
||||
`git-rev-parse --parseopt` input format is fully text based. It has two parts,
|
||||
separated by a line that contains only `--`. The lines before the separator
|
||||
(should be more than one) are used for the usage.
|
||||
The lines after the separator describe the options.
|
||||
|
||||
Each line of options has this format:
|
||||
|
||||
------------
|
||||
<opt_spec><arg_spec>? SP+ help LF
|
||||
------------
|
||||
|
||||
`<opt_spec>`::
|
||||
its format is the short option character, then the long option name
|
||||
separated by a comma. Both parts are not required, though at least one
|
||||
is necessary. `h,help`, `dry-run` and `f` are all three correct
|
||||
`<opt_spec>`.
|
||||
|
||||
`<arg_spec>`::
|
||||
an `<arg_spec>` tells the option parser if the option has an argument
|
||||
(`=`), an optional one (`?` though its use is discouraged) or none
|
||||
(no `<arg_spec>` in that case).
|
||||
|
||||
The remainder of the line, after stripping the spaces, is used
|
||||
as the help associated to the option.
|
||||
|
||||
Blank lines are ignored, and lines that don't match this specification are used
|
||||
as option group headers (start the line with a space to create such
|
||||
lines on purpose).
|
||||
|
||||
Example
|
||||
~~~~~~~
|
||||
|
||||
------------
|
||||
OPTS_SPEC="\
|
||||
some-command [options] <args>...
|
||||
|
||||
some-command does foo and bar!
|
||||
--
|
||||
h,help show the help
|
||||
|
||||
foo some nifty option --foo
|
||||
bar= some cool option --bar with an argument
|
||||
|
||||
An option group Header
|
||||
C? option C with an optional argument"
|
||||
|
||||
eval `echo "$OPTS_SPEC" | git-rev-parse --parseopt -- "$@" || echo exit $?`
|
||||
------------
|
||||
|
||||
|
||||
Author
|
||||
------
|
||||
Written by Linus Torvalds <torvalds@osdl.org> and
|
||||
Junio C Hamano <junkio@cox.net>
|
||||
Written by Linus Torvalds <torvalds@osdl.org> .
|
||||
Junio C Hamano <junkio@cox.net> and Pierre Habouzit <madcoder@debian.org>
|
||||
|
||||
Documentation
|
||||
--------------
|
||||
|
||||
@@ -193,6 +193,12 @@ Any other arguments are passed directly to `git log'
|
||||
repository (that has been init-ed with git-svn).
|
||||
The -r<revision> option is required for this.
|
||||
|
||||
'info'::
|
||||
Shows information about a file or directory similar to what
|
||||
`svn info' provides. Does not currently support a -r/--revision
|
||||
argument. Use the --url option to output only the value of the
|
||||
'URL:' field.
|
||||
|
||||
--
|
||||
|
||||
OPTIONS
|
||||
|
||||
@@ -46,6 +46,7 @@ Documentation for older releases are available here:
|
||||
* link:v1.5.3/git.html[documentation for release 1.5.3]
|
||||
|
||||
* release notes for
|
||||
link:RelNotes-1.5.3.6.txt[1.5.3.6],
|
||||
link:RelNotes-1.5.3.5.txt[1.5.3.5],
|
||||
link:RelNotes-1.5.3.4.txt[1.5.3.4],
|
||||
link:RelNotes-1.5.3.3.txt[1.5.3.3],
|
||||
|
||||
277
Documentation/howto/maintain-git.txt
Normal file
277
Documentation/howto/maintain-git.txt
Normal file
@@ -0,0 +1,277 @@
|
||||
From: Junio C Hamano <gitster@pobox.com>
|
||||
Date: Wed, 21 Nov 2007 16:32:55 -0800
|
||||
Subject: Addendum to "MaintNotes"
|
||||
Abstract: Imagine that git development is racing along as usual, when our friendly
|
||||
neighborhood maintainer is struck down by a wayward bus. Out of the
|
||||
hordes of suckers (loyal developers), you have been tricked (chosen) to
|
||||
step up as the new maintainer. This howto will show you "how to" do it.
|
||||
|
||||
The maintainer's git time is spent on three activities.
|
||||
|
||||
- Communication (60%)
|
||||
|
||||
Mailing list discussions on general design, fielding user
|
||||
questions, diagnosing bug reports; reviewing, commenting on,
|
||||
suggesting alternatives to, and rejecting patches.
|
||||
|
||||
- Integration (30%)
|
||||
|
||||
Applying new patches from the contributors while spotting and
|
||||
correcting minor mistakes, shuffling the integration and
|
||||
testing branches, pushing the results out, cutting the
|
||||
releases, and making announcements.
|
||||
|
||||
- Own development (10%)
|
||||
|
||||
Scratching my own itch and sending proposed patch series out.
|
||||
|
||||
The policy on Integration is informally mentioned in "A Note
|
||||
from the maintainer" message, which is periodically posted to
|
||||
this mailing list after each feature release is made.
|
||||
|
||||
The policy.
|
||||
|
||||
- Feature releases are numbered as vX.Y.Z and are meant to
|
||||
contain bugfixes and enhancements in any area, including
|
||||
functionality, performance and usability, without regression.
|
||||
|
||||
- Maintenance releases are numbered as vX.Y.Z.W and are meant
|
||||
to contain only bugfixes for the corresponding vX.Y.Z feature
|
||||
release and earlier maintenance releases vX.Y.Z.V (V < W).
|
||||
|
||||
- 'master' branch is used to prepare for the next feature
|
||||
release. In other words, at some point, the tip of 'master'
|
||||
branch is tagged with vX.Y.Z.
|
||||
|
||||
- 'maint' branch is used to prepare for the next maintenance
|
||||
release. After the feature release vX.Y.Z is made, the tip
|
||||
of 'maint' branch is set to that release, and bugfixes will
|
||||
accumulate on the branch, and at some point, the tip of the
|
||||
branch is tagged with vX.Y.Z.1, vX.Y.Z.2, and so on.
|
||||
|
||||
- 'next' branch is used to publish changes (both enhancements
|
||||
and fixes) that (1) have worthwhile goal, (2) are in a fairly
|
||||
good shape suitable for everyday use, (3) but have not yet
|
||||
demonstrated to be regression free. New changes are tested
|
||||
in 'next' before merged to 'master'.
|
||||
|
||||
- 'pu' branch is used to publish other proposed changes that do
|
||||
not yet pass the criteria set for 'next'.
|
||||
|
||||
- The tips of 'master', 'maint' and 'next' branches will always
|
||||
fast forward, to allow people to build their own
|
||||
customization on top of them.
|
||||
|
||||
- Usually 'master' contains all of 'maint', 'next' contains all
|
||||
of 'master' and 'pu' contains all of 'next'.
|
||||
|
||||
- The tip of 'master' is meant to be more stable than any
|
||||
tagged releases, and the users are encouraged to follow it.
|
||||
|
||||
- The 'next' branch is where new action takes place, and the
|
||||
users are encouraged to test it so that regressions and bugs
|
||||
are found before new topics are merged to 'master'.
|
||||
|
||||
|
||||
A typical git day for the maintainer implements the above policy
|
||||
by doing the following:
|
||||
|
||||
- Scan mailing list and #git channel log. Respond with review
|
||||
comments, suggestions etc. Kibitz. Collect potentially
|
||||
usable patches from the mailing list. Patches about a single
|
||||
topic go to one mailbox (I read my mail in Gnus, and type
|
||||
\C-o to save/append messages in files in mbox format).
|
||||
|
||||
- Review the patches in the saved mailboxes. Edit proposed log
|
||||
message for typofixes and clarifications, and add Acks
|
||||
collected from the list. Edit patch to incorporate "Oops,
|
||||
that should have been like this" fixes from the discussion.
|
||||
|
||||
- Classify the collected patches and handle 'master' and
|
||||
'maint' updates:
|
||||
|
||||
- Obviously correct fixes that pertain to the tip of 'maint'
|
||||
are directly applied to 'maint'.
|
||||
|
||||
- Obviously correct fixes that pertain to the tip of 'master'
|
||||
are directly applied to 'master'.
|
||||
|
||||
This step is done with "git am".
|
||||
|
||||
$ git checkout master ;# or "git checkout maint"
|
||||
$ git am -3 -s mailbox
|
||||
$ make test
|
||||
|
||||
- Merge downwards (maint->master):
|
||||
|
||||
$ git checkout master
|
||||
$ git merge maint
|
||||
$ make test
|
||||
|
||||
- Review the last issue of "What's cooking" message, review the
|
||||
topics scheduled for merging upwards (topic->master and
|
||||
topic->maint), and merge.
|
||||
|
||||
$ git checkout master ;# or "git checkout maint"
|
||||
$ git merge ai/topic ;# or "git merge ai/maint-topic"
|
||||
$ git log -p ORIG_HEAD.. ;# final review
|
||||
$ git diff ORIG_HEAD.. ;# final review
|
||||
$ make test ;# final review
|
||||
$ git branch -d ai/topic ;# or "git branch -d ai/maint-topic"
|
||||
|
||||
- Merge downwards (maint->master) if needed:
|
||||
|
||||
$ git checkout master
|
||||
$ git merge maint
|
||||
$ make test
|
||||
|
||||
- Merge downwards (master->next) if needed:
|
||||
|
||||
$ git checkout next
|
||||
$ git merge master
|
||||
$ make test
|
||||
|
||||
- Handle the remaining patches:
|
||||
|
||||
- Anything unobvious that is applicable to 'master' (in other
|
||||
words, does not depend on anything that is still in 'next'
|
||||
and not in 'master') is applied to a new topic branch that
|
||||
is forked from the tip of 'master'. This includes both
|
||||
enhancements and unobvious fixes to 'master'. A topic
|
||||
branch is named as ai/topic where "ai" is typically
|
||||
author's initial and "topic" is a descriptive name of the
|
||||
topic (in other words, "what's the series is about").
|
||||
|
||||
- An unobvious fix meant for 'maint' is applied to a new
|
||||
topic branch that is forked from the tip of 'maint'. The
|
||||
topic is named as ai/maint-topic.
|
||||
|
||||
- Changes that pertain to an existing topic are applied to
|
||||
the branch, but:
|
||||
|
||||
- obviously correct ones are applied first;
|
||||
|
||||
- questionable ones are discarded or applied to near the tip;
|
||||
|
||||
- Replacement patches to an existing topic are accepted only
|
||||
for commits not in 'next'.
|
||||
|
||||
The above except the "replacement" are all done with:
|
||||
|
||||
$ git am -3 -s mailbox
|
||||
|
||||
while patch replacement is often done by:
|
||||
|
||||
$ git format-patch ai/topic~$n..ai/topic ;# export existing
|
||||
|
||||
then replace some parts with the new patch, and reapplying:
|
||||
|
||||
$ git reset --hard ai/topic~$n
|
||||
$ git am -3 -s 000*.txt
|
||||
|
||||
The full test suite is always run for 'maint' and 'master'
|
||||
after patch application; for topic branches the tests are run
|
||||
as time permits.
|
||||
|
||||
- Update "What's cooking" message to review the updates to
|
||||
existing topics, newly added topics and graduated topics.
|
||||
|
||||
This step is helped with Meta/UWC script (where Meta/ contains
|
||||
a checkout of the 'todo' branch).
|
||||
|
||||
- Merge topics to 'next'. For each branch whose tip is not
|
||||
merged to 'next', one of three things can happen:
|
||||
|
||||
- The commits are all next-worthy; merge the topic to next:
|
||||
|
||||
$ git checkout next
|
||||
$ git merge ai/topic ;# or "git merge ai/maint-topic"
|
||||
$ make test
|
||||
|
||||
- The new parts are of mixed quality, but earlier ones are
|
||||
next-worthy; merge the early parts to next:
|
||||
|
||||
$ git checkout next
|
||||
$ git merge ai/topic~2 ;# the tip two are dubious
|
||||
$ make test
|
||||
|
||||
- Nothing is next-worthy; do not do anything.
|
||||
|
||||
- Rebase topics that do not have any commit in next yet. This
|
||||
step is optional but sometimes is worth doing when an old
|
||||
series that is not in next can take advantage of low-level
|
||||
framework change that is merged to 'master' already.
|
||||
|
||||
$ git rebase master ai/topic
|
||||
|
||||
This step is helped with Meta/git-topic.perl script to
|
||||
identify which topic is rebaseable. There also is a
|
||||
pre-rebase hook to make sure that topics that are already in
|
||||
'next' are not rebased beyond the merged commit.
|
||||
|
||||
- Rebuild "pu" to merge the tips of topics not in 'next'.
|
||||
|
||||
$ git checkout pu
|
||||
$ git reset --hard next
|
||||
$ git merge ai/topic ;# repeat for all remaining topics
|
||||
$ make test
|
||||
|
||||
This step is helped with Meta/PU script
|
||||
|
||||
- Push four integration branches to a private repository at
|
||||
k.org and run "make test" on all of them.
|
||||
|
||||
- Push four integration branches to /pub/scm/git/git.git at
|
||||
k.org. This triggers its post-update hook which:
|
||||
|
||||
(1) runs "git pull" in $HOME/git-doc/ repository to pull
|
||||
'master' just pushed out;
|
||||
|
||||
(2) runs "make doc" in $HOME/git-doc/, install the generated
|
||||
documentation in staging areas, which are separate
|
||||
repositories that have html and man branches checked
|
||||
out.
|
||||
|
||||
(3) runs "git commit" in the staging areas, and run "git
|
||||
push" back to /pub/scm/git/git.git/ to update the html
|
||||
and man branches.
|
||||
|
||||
(4) installs generated documentation to /pub/software/scm/git/docs/
|
||||
to be viewed from http://www.kernel.org/
|
||||
|
||||
- Fetch html and man branches back from k.org, and push four
|
||||
integration branches and the two documentation branches to
|
||||
repo.or.cz
|
||||
|
||||
|
||||
Some observations to be made.
|
||||
|
||||
* Each topic is tested individually, and also together with
|
||||
other topics cooking in 'next'. Until it matures, none part
|
||||
of it is merged to 'master'.
|
||||
|
||||
* A topic already in 'next' can get fixes while still in
|
||||
'next'. Such a topic will have many merges to 'next' (in
|
||||
other words, "git log --first-parent next" will show many
|
||||
"Merge ai/topic to next" for the same topic.
|
||||
|
||||
* An unobvious fix for 'maint' is cooked in 'next' and then
|
||||
merged to 'master' to make extra sure it is Ok and then
|
||||
merged to 'maint'.
|
||||
|
||||
* Even when 'next' becomes empty (in other words, all topics
|
||||
prove stable and are merged to 'master' and "git diff master
|
||||
next" shows empty), it has tons of merge commits that will
|
||||
never be in 'master'.
|
||||
|
||||
* In principle, "git log --first-parent master..next" should
|
||||
show nothing but merges (in practice, there are fixup commits
|
||||
and reverts that are not merges).
|
||||
|
||||
* Commits near the tip of a topic branch that are not in 'next'
|
||||
are fair game to be discarded, replaced or rewritten.
|
||||
Commits already merged to 'next' will not be.
|
||||
|
||||
* Being in the 'next' branch is not a guarantee for a topic to
|
||||
be included in the next feature release. Being in the
|
||||
'master' branch typically is.
|
||||
@@ -36,5 +36,11 @@ To sync with a local directory, you can use:
|
||||
- file:///path/to/repo.git/
|
||||
===============================================================
|
||||
|
||||
ifndef::git-clone[]
|
||||
They are mostly equivalent, except when cloning. See
|
||||
gitlink:git-clone[1] for details.
|
||||
endif::git-clone[]
|
||||
|
||||
ifdef::git-clone[]
|
||||
They are equivalent, except the former implies --local option.
|
||||
endif::git-clone[]
|
||||
|
||||
@@ -658,16 +658,23 @@ gitlink:git-diff[1]:
|
||||
$ git diff master..test
|
||||
-------------------------------------------------
|
||||
|
||||
Sometimes what you want instead is a set of patches:
|
||||
That will produce the diff between the tips of the two branches. If
|
||||
you'd prefer to find the diff from their common ancestor to test, you
|
||||
can use three dots instead of two:
|
||||
|
||||
-------------------------------------------------
|
||||
$ git diff master...test
|
||||
-------------------------------------------------
|
||||
|
||||
Sometimes what you want instead is a set of patches; for this you can
|
||||
use gitlink:git-format-patch[1]:
|
||||
|
||||
-------------------------------------------------
|
||||
$ git format-patch master..test
|
||||
-------------------------------------------------
|
||||
|
||||
will generate a file with a patch for each commit reachable from test
|
||||
but not from master. Note that if master also has commits which are
|
||||
not reachable from test, then the combined result of these patches
|
||||
will not be the same as the diff produced by the git-diff example.
|
||||
but not from master.
|
||||
|
||||
[[viewing-old-file-versions]]
|
||||
Viewing old file versions
|
||||
@@ -1567,9 +1574,9 @@ old history using, for example,
|
||||
$ git log master@{1}
|
||||
-------------------------------------------------
|
||||
|
||||
This lists the commits reachable from the previous version of the head.
|
||||
This syntax can be used with any git command that accepts a commit,
|
||||
not just with git log. Some other examples:
|
||||
This lists the commits reachable from the previous version of the
|
||||
"master" branch head. This syntax can be used with any git command
|
||||
that accepts a commit, not just with git log. Some other examples:
|
||||
|
||||
-------------------------------------------------
|
||||
$ git show master@{2} # See where the branch pointed 2,
|
||||
@@ -2554,6 +2561,72 @@ branches into their own work.
|
||||
For true distributed development that supports proper merging,
|
||||
published branches should never be rewritten.
|
||||
|
||||
[[bisect-merges]]
|
||||
Why bisecting merge commits can be harder than bisecting linear history
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
The gitlink:git-bisect[1] command correctly handles history that
|
||||
includes merge commits. However, when the commit that it finds is a
|
||||
merge commit, the user may need to work harder than usual to figure out
|
||||
why that commit introduced a problem.
|
||||
|
||||
Imagine this history:
|
||||
|
||||
................................................
|
||||
---Z---o---X---...---o---A---C---D
|
||||
\ /
|
||||
o---o---Y---...---o---B
|
||||
................................................
|
||||
|
||||
Suppose that on the upper line of development, the meaning of one
|
||||
of the functions that exists at Z is changed at commit X. The
|
||||
commits from Z leading to A change both the function's
|
||||
implementation and all calling sites that exist at Z, as well
|
||||
as new calling sites they add, to be consistent. There is no
|
||||
bug at A.
|
||||
|
||||
Suppose that in the meantime on the lower line of development somebody
|
||||
adds a new calling site for that function at commit Y. The
|
||||
commits from Z leading to B all assume the old semantics of that
|
||||
function and the callers and the callee are consistent with each
|
||||
other. There is no bug at B, either.
|
||||
|
||||
Suppose further that the two development lines merge cleanly at C,
|
||||
so no conflict resolution is required.
|
||||
|
||||
Nevertheless, the code at C is broken, because the callers added
|
||||
on the lower line of development have not been converted to the new
|
||||
semantics introduced on the upper line of development. So if all
|
||||
you know is that D is bad, that Z is good, and that
|
||||
gitlink:git-bisect[1] identifies C as the culprit, how will you
|
||||
figure out that the problem is due to this change in semantics?
|
||||
|
||||
When the result of a git-bisect is a non-merge commit, you should
|
||||
normally be able to discover the problem by examining just that commit.
|
||||
Developers can make this easy by breaking their changes into small
|
||||
self-contained commits. That won't help in the case above, however,
|
||||
because the problem isn't obvious from examination of any single
|
||||
commit; instead, a global view of the development is required. To
|
||||
make matters worse, the change in semantics in the problematic
|
||||
function may be just one small part of the changes in the upper
|
||||
line of development.
|
||||
|
||||
On the other hand, if instead of merging at C you had rebased the
|
||||
history between Z to B on top of A, you would have gotten this
|
||||
linear history:
|
||||
|
||||
................................................................
|
||||
---Z---o---X--...---o---A---o---o---Y*--...---o---B*--D*
|
||||
................................................................
|
||||
|
||||
Bisecting between Z and D* would hit a single culprit commit Y*,
|
||||
and understanding why Y* was broken would probably be easier.
|
||||
|
||||
Partly for this reason, many experienced git users, even when
|
||||
working on an otherwise merge-heavy project, keep the history
|
||||
linear by rebasing against the latest upstream version before
|
||||
publishing.
|
||||
|
||||
[[advanced-branch-management]]
|
||||
Advanced branch management
|
||||
==========================
|
||||
|
||||
6
Makefile
6
Makefile
@@ -221,7 +221,7 @@ SCRIPT_SH = \
|
||||
git-sh-setup.sh \
|
||||
git-am.sh \
|
||||
git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
|
||||
git-merge-resolve.sh git-merge-ours.sh \
|
||||
git-merge-resolve.sh \
|
||||
git-lost-found.sh git-quiltimport.sh git-submodule.sh \
|
||||
git-filter-branch.sh \
|
||||
git-stash.sh
|
||||
@@ -352,6 +352,7 @@ BUILTIN_OBJS = \
|
||||
builtin-mailsplit.o \
|
||||
builtin-merge-base.o \
|
||||
builtin-merge-file.o \
|
||||
builtin-merge-ours.o \
|
||||
builtin-mv.o \
|
||||
builtin-name-rev.o \
|
||||
builtin-pack-objects.o \
|
||||
@@ -415,18 +416,17 @@ ifeq ($(uname_S),SunOS)
|
||||
NO_STRCASESTR = YesPlease
|
||||
NO_MEMMEM = YesPlease
|
||||
NO_HSTRERROR = YesPlease
|
||||
NO_MKDTEMP = YesPlease
|
||||
ifeq ($(uname_R),5.8)
|
||||
NEEDS_LIBICONV = YesPlease
|
||||
NO_UNSETENV = YesPlease
|
||||
NO_SETENV = YesPlease
|
||||
NO_MKDTEMP = YesPlease
|
||||
NO_C99_FORMAT = YesPlease
|
||||
NO_STRTOUMAX = YesPlease
|
||||
endif
|
||||
ifeq ($(uname_R),5.9)
|
||||
NO_UNSETENV = YesPlease
|
||||
NO_SETENV = YesPlease
|
||||
NO_MKDTEMP = YesPlease
|
||||
NO_C99_FORMAT = YesPlease
|
||||
NO_STRTOUMAX = YesPlease
|
||||
endif
|
||||
|
||||
@@ -683,7 +683,6 @@ static char *git_header_name(char *line, int llen)
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Verify that we recognize the lines following a git header */
|
||||
|
||||
@@ -335,7 +335,7 @@ static struct origin *find_origin(struct scoreboard *sb,
|
||||
* same and diff-tree is fairly efficient about this.
|
||||
*/
|
||||
diff_setup(&diff_opts);
|
||||
diff_opts.recursive = 1;
|
||||
DIFF_OPT_SET(&diff_opts, RECURSIVE);
|
||||
diff_opts.detect_rename = 0;
|
||||
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||
paths[0] = origin->path;
|
||||
@@ -409,7 +409,7 @@ static struct origin *find_rename(struct scoreboard *sb,
|
||||
const char *paths[2];
|
||||
|
||||
diff_setup(&diff_opts);
|
||||
diff_opts.recursive = 1;
|
||||
DIFF_OPT_SET(&diff_opts, RECURSIVE);
|
||||
diff_opts.detect_rename = DIFF_DETECT_RENAME;
|
||||
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||
diff_opts.single_follow = origin->path;
|
||||
@@ -1075,7 +1075,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
|
||||
return 1; /* nothing remains for this target */
|
||||
|
||||
diff_setup(&diff_opts);
|
||||
diff_opts.recursive = 1;
|
||||
DIFF_OPT_SET(&diff_opts, RECURSIVE);
|
||||
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||
|
||||
paths[0] = NULL;
|
||||
@@ -1093,7 +1093,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
|
||||
if ((opt & PICKAXE_BLAME_COPY_HARDEST)
|
||||
|| ((opt & PICKAXE_BLAME_COPY_HARDER)
|
||||
&& (!porigin || strcmp(target->path, porigin->path))))
|
||||
diff_opts.find_copies_harder = 1;
|
||||
DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
|
||||
|
||||
if (is_null_sha1(target->commit->object.sha1))
|
||||
do_diff_cache(parent->tree->object.sha1, &diff_opts);
|
||||
@@ -1102,7 +1102,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
|
||||
target->commit->tree->object.sha1,
|
||||
"", &diff_opts);
|
||||
|
||||
if (!diff_opts.find_copies_harder)
|
||||
if (!DIFF_OPT_TST(&diff_opts, FIND_COPIES_HARDER))
|
||||
diffcore_std(&diff_opts);
|
||||
|
||||
retval = 0;
|
||||
|
||||
@@ -507,48 +507,36 @@ static void rename_branch(const char *oldname, const char *newname, int force)
|
||||
|
||||
int cmd_branch(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
int delete = 0, force_delete = 0, force_create = 0;
|
||||
int rename = 0, force_rename = 0;
|
||||
int delete = 0, rename = 0, force_create = 0;
|
||||
int verbose = 0, abbrev = DEFAULT_ABBREV, detached = 0;
|
||||
int reflog = 0, track;
|
||||
int kinds = REF_LOCAL_BRANCH, kind_remote = 0, kind_any = 0;
|
||||
int kinds = REF_LOCAL_BRANCH;
|
||||
|
||||
struct option options[] = {
|
||||
OPT_GROUP("Generic options"),
|
||||
OPT__VERBOSE(&verbose),
|
||||
OPT_BOOLEAN( 0 , "track", &track, "set up tracking mode (see git-pull(1))"),
|
||||
OPT_BOOLEAN( 0 , "color", &branch_use_color, "use colored output"),
|
||||
OPT_BOOLEAN('r', NULL, &kind_remote, "act on remote-tracking branches"),
|
||||
OPT_SET_INT('r', NULL, &kinds, "act on remote-tracking branches",
|
||||
REF_REMOTE_BRANCH),
|
||||
OPT__ABBREV(&abbrev),
|
||||
|
||||
OPT_GROUP("Specific git-branch actions:"),
|
||||
OPT_BOOLEAN('a', NULL, &kind_any, "list both remote-tracking and local branches"),
|
||||
OPT_BOOLEAN('d', NULL, &delete, "delete fully merged branch"),
|
||||
OPT_BOOLEAN('D', NULL, &force_delete, "delete branch (even if not merged)"),
|
||||
OPT_BOOLEAN('l', NULL, &reflog, "create the branch's reflog"),
|
||||
OPT_BOOLEAN('f', NULL, &force_create, "force creation (when already exists)"),
|
||||
OPT_BOOLEAN('m', NULL, &rename, "move/rename a branch and its reflog"),
|
||||
OPT_BOOLEAN('M', NULL, &force_rename, "move/rename a branch, even if target exists"),
|
||||
OPT_SET_INT('a', NULL, &kinds, "list both remote-tracking and local branches",
|
||||
REF_REMOTE_BRANCH | REF_LOCAL_BRANCH),
|
||||
OPT_BIT('d', NULL, &delete, "delete fully merged branch", 1),
|
||||
OPT_BIT('D', NULL, &delete, "delete branch (even if not merged)", 2),
|
||||
OPT_BIT('m', NULL, &rename, "move/rename a branch and its reflog", 1),
|
||||
OPT_BIT('M', NULL, &rename, "move/rename a branch, even if target exists", 2),
|
||||
OPT_BOOLEAN('l', NULL, &reflog, "create the branch's reflog"),
|
||||
OPT_BOOLEAN('f', NULL, &force_create, "force creation (when already exists)"),
|
||||
OPT_END(),
|
||||
};
|
||||
|
||||
git_config(git_branch_config);
|
||||
track = branch_track;
|
||||
argc = parse_options(argc, argv, options, builtin_branch_usage, 0);
|
||||
|
||||
delete |= force_delete;
|
||||
rename |= force_rename;
|
||||
if (kind_remote)
|
||||
kinds = REF_REMOTE_BRANCH;
|
||||
if (kind_any)
|
||||
kinds = REF_REMOTE_BRANCH | REF_LOCAL_BRANCH;
|
||||
if (abbrev && abbrev < MINIMUM_ABBREV)
|
||||
abbrev = MINIMUM_ABBREV;
|
||||
else if (abbrev > 40)
|
||||
abbrev = 40;
|
||||
|
||||
if ((delete && rename) || (delete && force_create) ||
|
||||
(rename && force_create))
|
||||
if (!!delete + !!rename + !!force_create > 1)
|
||||
usage_with_options(builtin_branch_usage, options);
|
||||
|
||||
head = resolve_ref("HEAD", head_sha1, 0, NULL);
|
||||
@@ -564,13 +552,13 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
|
||||
}
|
||||
|
||||
if (delete)
|
||||
return delete_branches(argc, argv, force_delete, kinds);
|
||||
return delete_branches(argc, argv, delete > 1, kinds);
|
||||
else if (argc == 0)
|
||||
print_ref_list(kinds, detached, verbose, abbrev);
|
||||
else if (rename && (argc == 1))
|
||||
rename_branch(head, argv[0], force_rename);
|
||||
rename_branch(head, argv[0], rename > 1);
|
||||
else if (rename && (argc == 2))
|
||||
rename_branch(argv[0], argv[1], force_rename);
|
||||
rename_branch(argv[0], argv[1], rename > 1);
|
||||
else if (argc <= 2)
|
||||
create_branch(argv[0], (argc == 2) ? argv[1] : head,
|
||||
force_create, reflog, track);
|
||||
|
||||
@@ -31,5 +31,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
|
||||
if (!rev.diffopt.output_format)
|
||||
rev.diffopt.output_format = DIFF_FORMAT_RAW;
|
||||
result = run_diff_files_cmd(&rev, argc, argv);
|
||||
return rev.diffopt.exit_with_status ? rev.diffopt.has_changes: result;
|
||||
if (DIFF_OPT_TST(&rev.diffopt, EXIT_WITH_STATUS))
|
||||
return DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES) != 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -44,5 +44,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
|
||||
return -1;
|
||||
}
|
||||
result = run_diff_index(&rev, cached);
|
||||
return rev.diffopt.exit_with_status ? rev.diffopt.has_changes: result;
|
||||
if (DIFF_OPT_TST(&rev.diffopt, EXIT_WITH_STATUS))
|
||||
return DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES) != 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -118,8 +118,8 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
|
||||
}
|
||||
|
||||
if (!read_stdin)
|
||||
return opt->diffopt.exit_with_status ?
|
||||
opt->diffopt.has_changes: 0;
|
||||
return DIFF_OPT_TST(&opt->diffopt, EXIT_WITH_STATUS)
|
||||
&& DIFF_OPT_TST(&opt->diffopt, HAS_CHANGES);
|
||||
|
||||
if (opt->diffopt.detect_rename)
|
||||
opt->diffopt.setup |= (DIFF_SETUP_USE_SIZE_CACHE |
|
||||
@@ -134,5 +134,6 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
|
||||
else
|
||||
diff_tree_stdin(line);
|
||||
}
|
||||
return opt->diffopt.exit_with_status ? opt->diffopt.has_changes: 0;
|
||||
return DIFF_OPT_TST(&opt->diffopt, EXIT_WITH_STATUS)
|
||||
&& DIFF_OPT_TST(&opt->diffopt, HAS_CHANGES);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ static void stuff_change(struct diff_options *opt,
|
||||
!hashcmp(old_sha1, new_sha1) && (old_mode == new_mode))
|
||||
return;
|
||||
|
||||
if (opt->reverse_diff) {
|
||||
if (DIFF_OPT_TST(opt, REVERSE_DIFF)) {
|
||||
unsigned tmp;
|
||||
const unsigned char *tmp_u;
|
||||
const char *tmp_c;
|
||||
@@ -253,13 +253,13 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
||||
if (diff_setup_done(&rev.diffopt) < 0)
|
||||
die("diff_setup_done failed");
|
||||
}
|
||||
rev.diffopt.allow_external = 1;
|
||||
rev.diffopt.recursive = 1;
|
||||
DIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);
|
||||
DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
|
||||
|
||||
/* If the user asked for our exit code then don't start a
|
||||
* pager or we would end up reporting its exit code instead.
|
||||
*/
|
||||
if (!rev.diffopt.exit_with_status)
|
||||
if (!DIFF_OPT_TST(&rev.diffopt, EXIT_WITH_STATUS))
|
||||
setup_pager();
|
||||
|
||||
/* Do we have --cached and not have a pending object, then
|
||||
@@ -363,8 +363,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
||||
else
|
||||
result = builtin_diff_combined(&rev, argc, argv,
|
||||
ent, ents);
|
||||
if (rev.diffopt.exit_with_status)
|
||||
result = rev.diffopt.has_changes;
|
||||
if (DIFF_OPT_TST(&rev.diffopt, EXIT_WITH_STATUS))
|
||||
result = DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES) != 0;
|
||||
|
||||
if (1 < rev.diffopt.skip_stat_unmatch)
|
||||
refresh_index_quietly();
|
||||
|
||||
@@ -178,7 +178,7 @@ static void shortlog(const char *name, unsigned char *sha1,
|
||||
struct commit *commit;
|
||||
struct object *branch;
|
||||
struct list subjects = { NULL, NULL, 0, 0 };
|
||||
int flags = UNINTERESTING | TREECHANGE | SEEN | SHOWN | ADDED;
|
||||
int flags = UNINTERESTING | TREESAME | SEEN | SHOWN | ADDED;
|
||||
|
||||
branch = deref_tag(parse_object(sha1), sha1_to_hex(sha1), 40);
|
||||
if (!branch || branch->type != OBJ_COMMIT)
|
||||
|
||||
@@ -833,16 +833,19 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
|
||||
int i, num_refs;
|
||||
const char *format = "%(objectname) %(objecttype)\t%(refname)";
|
||||
struct ref_sort *sort = NULL, **sort_tail = &sort;
|
||||
int maxcount = 0, quote_style;
|
||||
int quote_shell = 0, quote_perl = 0, quote_python = 0, quote_tcl = 0;
|
||||
int maxcount = 0, quote_style = 0;
|
||||
struct refinfo **refs;
|
||||
struct grab_ref_cbdata cbdata;
|
||||
|
||||
struct option opts[] = {
|
||||
OPT_BOOLEAN('s', "shell", "e_shell, "quote placeholders suitably for shells"),
|
||||
OPT_BOOLEAN('p', "perl", "e_perl, "quote placeholders suitably for perl"),
|
||||
OPT_BOOLEAN( 0 , "python", "e_python, "quote placeholders suitably for python"),
|
||||
OPT_BOOLEAN( 0 , "tcl", "e_tcl, "quote placeholders suitably for tcl"),
|
||||
OPT_BIT('s', "shell", "e_style,
|
||||
"quote placeholders suitably for shells", QUOTE_SHELL),
|
||||
OPT_BIT('p', "perl", "e_style,
|
||||
"quote placeholders suitably for perl", QUOTE_PERL),
|
||||
OPT_BIT(0 , "python", "e_style,
|
||||
"quote placeholders suitably for python", QUOTE_PYTHON),
|
||||
OPT_BIT(0 , "tcl", "e_style,
|
||||
"quote placeholders suitably for tcl", QUOTE_TCL),
|
||||
|
||||
OPT_GROUP(""),
|
||||
OPT_INTEGER( 0 , "count", &maxcount, "show only <n> matched refs"),
|
||||
@@ -857,15 +860,13 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
|
||||
error("invalid --count argument: `%d'", maxcount);
|
||||
usage_with_options(for_each_ref_usage, opts);
|
||||
}
|
||||
if (quote_shell + quote_perl + quote_python + quote_tcl > 1) {
|
||||
if (HAS_MULTI_BITS(quote_style)) {
|
||||
error("more than one quoting style ?");
|
||||
usage_with_options(for_each_ref_usage, opts);
|
||||
}
|
||||
if (verify_format(format))
|
||||
usage_with_options(for_each_ref_usage, opts);
|
||||
|
||||
quote_style = QUOTE_SHELL * quote_shell + QUOTE_PERL * quote_perl +
|
||||
QUOTE_PYTHON * quote_python + QUOTE_TCL * quote_tcl;
|
||||
if (!sort)
|
||||
sort = default_sort();
|
||||
sort_atom_limit = used_atom_cnt;
|
||||
|
||||
@@ -294,7 +294,7 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
|
||||
if (opt->pre_context) {
|
||||
push_arg("-B");
|
||||
len += snprintf(argptr, sizeof(randarg)-len,
|
||||
"%u", opt->pre_context);
|
||||
"%u", opt->pre_context) + 1;
|
||||
if (sizeof(randarg) <= len)
|
||||
die("maximum length of args exceeded");
|
||||
push_arg(argptr);
|
||||
@@ -303,7 +303,7 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
|
||||
if (opt->post_context) {
|
||||
push_arg("-A");
|
||||
len += snprintf(argptr, sizeof(randarg)-len,
|
||||
"%u", opt->post_context);
|
||||
"%u", opt->post_context) + 1;
|
||||
if (sizeof(randarg) <= len)
|
||||
die("maximum length of args exceeded");
|
||||
push_arg(argptr);
|
||||
@@ -313,7 +313,7 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
|
||||
else {
|
||||
push_arg("-C");
|
||||
len += snprintf(argptr, sizeof(randarg)-len,
|
||||
"%u", opt->post_context);
|
||||
"%u", opt->post_context) + 1;
|
||||
if (sizeof(randarg) <= len)
|
||||
die("maximum length of args exceeded");
|
||||
push_arg(argptr);
|
||||
|
||||
147
builtin-log.c
147
builtin-log.c
@@ -55,13 +55,13 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
|
||||
rev->abbrev = DEFAULT_ABBREV;
|
||||
rev->commit_format = CMIT_FMT_DEFAULT;
|
||||
rev->verbose_header = 1;
|
||||
rev->diffopt.recursive = 1;
|
||||
DIFF_OPT_SET(&rev->diffopt, RECURSIVE);
|
||||
rev->show_root_diff = default_show_root;
|
||||
rev->subject_prefix = fmt_patch_subject_prefix;
|
||||
argc = setup_revisions(argc, argv, rev, "HEAD");
|
||||
if (rev->diffopt.pickaxe || rev->diffopt.filter)
|
||||
rev->always_show_header = 0;
|
||||
if (rev->diffopt.follow_renames) {
|
||||
if (DIFF_OPT_TST(&rev->diffopt, FOLLOW_RENAMES)) {
|
||||
rev->always_show_header = 0;
|
||||
if (rev->diffopt.nr_paths != 1)
|
||||
usage("git logs can only follow renames on one pathname at a time");
|
||||
@@ -77,11 +77,134 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This gives a rough estimate for how many commits we
|
||||
* will print out in the list.
|
||||
*/
|
||||
static int estimate_commit_count(struct rev_info *rev, struct commit_list *list)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
while (list) {
|
||||
struct commit *commit = list->item;
|
||||
unsigned int flags = commit->object.flags;
|
||||
list = list->next;
|
||||
if (!(flags & (TREESAME | UNINTERESTING)))
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
static void show_early_header(struct rev_info *rev, const char *stage, int nr)
|
||||
{
|
||||
if (rev->shown_one) {
|
||||
rev->shown_one = 0;
|
||||
if (rev->commit_format != CMIT_FMT_ONELINE)
|
||||
putchar(rev->diffopt.line_termination);
|
||||
}
|
||||
printf("Final output: %d %s\n", nr, stage);
|
||||
}
|
||||
|
||||
struct itimerval early_output_timer;
|
||||
|
||||
static void log_show_early(struct rev_info *revs, struct commit_list *list)
|
||||
{
|
||||
int i = revs->early_output;
|
||||
int show_header = 1;
|
||||
|
||||
sort_in_topological_order(&list, revs->lifo);
|
||||
while (list && i) {
|
||||
struct commit *commit = list->item;
|
||||
switch (simplify_commit(revs, commit)) {
|
||||
case commit_show:
|
||||
if (show_header) {
|
||||
int n = estimate_commit_count(revs, list);
|
||||
show_early_header(revs, "incomplete", n);
|
||||
show_header = 0;
|
||||
}
|
||||
log_tree_commit(revs, commit);
|
||||
i--;
|
||||
break;
|
||||
case commit_ignore:
|
||||
break;
|
||||
case commit_error:
|
||||
return;
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
/* Did we already get enough commits for the early output? */
|
||||
if (!i)
|
||||
return;
|
||||
|
||||
/*
|
||||
* ..if no, then repeat it twice a second until we
|
||||
* do.
|
||||
*
|
||||
* NOTE! We don't use "it_interval", because if the
|
||||
* reader isn't listening, we want our output to be
|
||||
* throttled by the writing, and not have the timer
|
||||
* trigger every second even if we're blocked on a
|
||||
* reader!
|
||||
*/
|
||||
early_output_timer.it_value.tv_sec = 0;
|
||||
early_output_timer.it_value.tv_usec = 500000;
|
||||
setitimer(ITIMER_REAL, &early_output_timer, NULL);
|
||||
}
|
||||
|
||||
static void early_output(int signal)
|
||||
{
|
||||
show_early_output = log_show_early;
|
||||
}
|
||||
|
||||
static void setup_early_output(struct rev_info *rev)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
/*
|
||||
* Set up the signal handler, minimally intrusively:
|
||||
* we only set a single volatile integer word (not
|
||||
* using sigatomic_t - trying to avoid unnecessary
|
||||
* system dependencies and headers), and using
|
||||
* SA_RESTART.
|
||||
*/
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sa_handler = early_output;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigaction(SIGALRM, &sa, NULL);
|
||||
|
||||
/*
|
||||
* If we can get the whole output in less than a
|
||||
* tenth of a second, don't even bother doing the
|
||||
* early-output thing..
|
||||
*
|
||||
* This is a one-time-only trigger.
|
||||
*/
|
||||
early_output_timer.it_value.tv_sec = 0;
|
||||
early_output_timer.it_value.tv_usec = 100000;
|
||||
setitimer(ITIMER_REAL, &early_output_timer, NULL);
|
||||
}
|
||||
|
||||
static void finish_early_output(struct rev_info *rev)
|
||||
{
|
||||
int n = estimate_commit_count(rev, rev->commits);
|
||||
signal(SIGALRM, SIG_IGN);
|
||||
show_early_header(rev, "done", n);
|
||||
}
|
||||
|
||||
static int cmd_log_walk(struct rev_info *rev)
|
||||
{
|
||||
struct commit *commit;
|
||||
|
||||
if (rev->early_output)
|
||||
setup_early_output(rev);
|
||||
|
||||
prepare_revision_walk(rev);
|
||||
|
||||
if (rev->early_output)
|
||||
finish_early_output(rev);
|
||||
|
||||
while ((commit = get_revision(rev)) != NULL) {
|
||||
log_tree_commit(rev, commit);
|
||||
if (!rev->reflog_info) {
|
||||
@@ -185,11 +308,9 @@ int cmd_show(int argc, const char **argv, const char *prefix)
|
||||
struct tag *t = (struct tag *)o;
|
||||
|
||||
printf("%stag %s%s\n\n",
|
||||
diff_get_color(rev.diffopt.color_diff,
|
||||
DIFF_COMMIT),
|
||||
diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),
|
||||
t->tag,
|
||||
diff_get_color(rev.diffopt.color_diff,
|
||||
DIFF_RESET));
|
||||
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
|
||||
ret = show_object(o->sha1, 1);
|
||||
objects[i].item = (struct object *)t->tagged;
|
||||
i--;
|
||||
@@ -197,11 +318,9 @@ int cmd_show(int argc, const char **argv, const char *prefix)
|
||||
}
|
||||
case OBJ_TREE:
|
||||
printf("%stree %s%s\n\n",
|
||||
diff_get_color(rev.diffopt.color_diff,
|
||||
DIFF_COMMIT),
|
||||
diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),
|
||||
name,
|
||||
diff_get_color(rev.diffopt.color_diff,
|
||||
DIFF_RESET));
|
||||
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
|
||||
read_tree_recursive((struct tree *)o, "", 0, 0, NULL,
|
||||
show_tree_object);
|
||||
break;
|
||||
@@ -497,7 +616,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||
rev.combine_merges = 0;
|
||||
rev.ignore_merges = 1;
|
||||
rev.diffopt.msg_sep = "";
|
||||
rev.diffopt.recursive = 1;
|
||||
DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
|
||||
|
||||
rev.subject_prefix = fmt_patch_subject_prefix;
|
||||
rev.extra_headers = extra_headers;
|
||||
@@ -605,8 +724,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||
if (!rev.diffopt.output_format)
|
||||
rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH;
|
||||
|
||||
if (!rev.diffopt.text)
|
||||
rev.diffopt.binary = 1;
|
||||
if (!DIFF_OPT_TST(&rev.diffopt, TEXT))
|
||||
DIFF_OPT_SET(&rev.diffopt, BINARY);
|
||||
|
||||
if (!output_directory && !use_stdout)
|
||||
output_directory = prefix;
|
||||
@@ -764,7 +883,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
|
||||
revs.diff = 1;
|
||||
revs.combine_merges = 0;
|
||||
revs.ignore_merges = 1;
|
||||
revs.diffopt.recursive = 1;
|
||||
DIFF_OPT_SET(&revs.diffopt, RECURSIVE);
|
||||
|
||||
if (add_pending_commit(head, &revs, 0))
|
||||
die("Unknown commit %s", head);
|
||||
|
||||
@@ -387,8 +387,8 @@ static void overlay_tree(const char *tree_name, const char *prefix)
|
||||
static const char ls_files_usage[] =
|
||||
"git-ls-files [-z] [-t] [-v] (--[cached|deleted|others|stage|unmerged|killed|modified])* "
|
||||
"[ --ignored ] [--exclude=<pattern>] [--exclude-from=<file>] "
|
||||
"[ --exclude-per-directory=<filename> ] [--full-name] [--abbrev] "
|
||||
"[--] [<file>]*";
|
||||
"[ --exclude-per-directory=<filename> ] [--exclude-standard] "
|
||||
"[--full-name] [--abbrev] [--] [<file>]*";
|
||||
|
||||
int cmd_ls_files(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
@@ -496,6 +496,11 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
|
||||
dir.exclude_per_dir = arg + 24;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(arg, "--exclude-standard")) {
|
||||
exc_given = 1;
|
||||
setup_standard_excludes(&dir);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(arg, "--full-name")) {
|
||||
prefix_offset = 0;
|
||||
continue;
|
||||
|
||||
28
builtin-merge-ours.c
Normal file
28
builtin-merge-ours.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Implementation of git-merge-ours.sh as builtin
|
||||
*
|
||||
* Copyright (c) 2007 Thomas Harning Jr
|
||||
* Original:
|
||||
* Original Copyright (c) 2005 Junio C Hamano
|
||||
*
|
||||
* Pretend we resolved the heads, but declare our tree trumps everybody else.
|
||||
*/
|
||||
#include "git-compat-util.h"
|
||||
#include "builtin.h"
|
||||
|
||||
static const char *diff_index_args[] = {
|
||||
"diff-index", "--quiet", "--cached", "HEAD", "--", NULL
|
||||
};
|
||||
#define NARGS (ARRAY_SIZE(diff_index_args) - 1)
|
||||
|
||||
int cmd_merge_ours(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
/*
|
||||
* We need to exit with 2 if the index does not match our HEAD tree,
|
||||
* because the current index is what we will be committing as the
|
||||
* merge result.
|
||||
*/
|
||||
if (cmd_diff_index(NARGS, diff_index_args, prefix))
|
||||
exit(2);
|
||||
exit(0);
|
||||
}
|
||||
@@ -990,7 +990,7 @@ static void add_pbase_object(struct tree_desc *tree,
|
||||
return;
|
||||
if (name[cmplen] != '/') {
|
||||
add_object_entry(entry.sha1,
|
||||
S_ISDIR(entry.mode) ? OBJ_TREE : OBJ_BLOB,
|
||||
object_type(entry.mode),
|
||||
fullname, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -122,19 +122,13 @@ static char const * const pack_refs_usage[] = {
|
||||
|
||||
int cmd_pack_refs(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
int all = 0, prune = 1;
|
||||
unsigned int flags = 0;
|
||||
unsigned int flags = PACK_REFS_PRUNE;
|
||||
struct option opts[] = {
|
||||
OPT_BOOLEAN(0, "all", &all, "pack everything"),
|
||||
OPT_BOOLEAN(0, "prune", &prune, "prune loose refs (default)"),
|
||||
OPT_BIT(0, "all", &flags, "pack everything", PACK_REFS_ALL),
|
||||
OPT_BIT(0, "prune", &flags, "prune loose refs (default)", PACK_REFS_PRUNE),
|
||||
OPT_END(),
|
||||
};
|
||||
|
||||
if (parse_options(argc, argv, opts, pack_refs_usage, 0))
|
||||
usage_with_options(pack_refs_usage, opts);
|
||||
if (prune)
|
||||
flags |= PACK_REFS_PRUNE;
|
||||
if (all)
|
||||
flags |= PACK_REFS_ALL;
|
||||
return pack_refs(flags);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ static int count_distance(struct commit_list *entry)
|
||||
|
||||
if (commit->object.flags & (UNINTERESTING | COUNTED))
|
||||
break;
|
||||
if (!revs.prune_fn || (commit->object.flags & TREECHANGE))
|
||||
if (!(commit->object.flags & TREESAME))
|
||||
nr++;
|
||||
commit->object.flags |= COUNTED;
|
||||
p = commit->parents;
|
||||
@@ -209,7 +209,7 @@ static inline int halfway(struct commit_list *p, int nr)
|
||||
/*
|
||||
* Don't short-cut something we are not going to return!
|
||||
*/
|
||||
if (revs.prune_fn && !(p->item->object.flags & TREECHANGE))
|
||||
if (p->item->object.flags & TREESAME)
|
||||
return 0;
|
||||
if (DEBUG_BISECT)
|
||||
return 0;
|
||||
@@ -245,7 +245,7 @@ static void show_list(const char *debug, int counted, int nr,
|
||||
char *ep, *sp;
|
||||
|
||||
fprintf(stderr, "%c%c%c ",
|
||||
(flags & TREECHANGE) ? 'T' : ' ',
|
||||
(flags & TREESAME) ? ' ' : 'T',
|
||||
(flags & UNINTERESTING) ? 'U' : ' ',
|
||||
(flags & COUNTED) ? 'C' : ' ');
|
||||
if (commit->util)
|
||||
@@ -279,7 +279,7 @@ static struct commit_list *best_bisection(struct commit_list *list, int nr)
|
||||
int distance;
|
||||
unsigned flags = p->item->object.flags;
|
||||
|
||||
if (revs.prune_fn && !(flags & TREECHANGE))
|
||||
if (flags & TREESAME)
|
||||
continue;
|
||||
distance = weight(p);
|
||||
if (nr - distance < distance)
|
||||
@@ -319,7 +319,7 @@ static struct commit_list *best_bisection_sorted(struct commit_list *list, int n
|
||||
int distance;
|
||||
unsigned flags = p->item->object.flags;
|
||||
|
||||
if (revs.prune_fn && !(flags & TREECHANGE))
|
||||
if (flags & TREESAME)
|
||||
continue;
|
||||
distance = weight(p);
|
||||
if (nr - distance < distance)
|
||||
@@ -373,7 +373,7 @@ static struct commit_list *do_find_bisection(struct commit_list *list,
|
||||
p->item->util = &weights[n++];
|
||||
switch (count_interesting_parents(commit)) {
|
||||
case 0:
|
||||
if (!revs.prune_fn || (flags & TREECHANGE)) {
|
||||
if (!(flags & TREESAME)) {
|
||||
weight_set(p, 1);
|
||||
counted++;
|
||||
show_list("bisection 2 count one",
|
||||
@@ -446,7 +446,7 @@ static struct commit_list *do_find_bisection(struct commit_list *list,
|
||||
* add one for p itself if p is to be counted,
|
||||
* otherwise inherit it from q directly.
|
||||
*/
|
||||
if (!revs.prune_fn || (flags & TREECHANGE)) {
|
||||
if (!(flags & TREESAME)) {
|
||||
weight_set(p, weight(q)+1);
|
||||
counted++;
|
||||
show_list("bisection 2 count one",
|
||||
@@ -493,7 +493,7 @@ static struct commit_list *find_bisection(struct commit_list *list,
|
||||
continue;
|
||||
p->next = last;
|
||||
last = p;
|
||||
if (!revs.prune_fn || (flags & TREECHANGE))
|
||||
if (!(flags & TREESAME))
|
||||
nr++;
|
||||
on_list++;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "refs.h"
|
||||
#include "quote.h"
|
||||
#include "builtin.h"
|
||||
#include "parse-options.h"
|
||||
|
||||
#define DO_REVS 1
|
||||
#define DO_NOREV 2
|
||||
@@ -209,13 +210,138 @@ static int try_difference(const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parseopt_dump(const struct option *o, const char *arg, int unset)
|
||||
{
|
||||
struct strbuf *parsed = o->value;
|
||||
if (unset)
|
||||
strbuf_addf(parsed, " --no-%s", o->long_name);
|
||||
else if (o->short_name)
|
||||
strbuf_addf(parsed, " -%c", o->short_name);
|
||||
else
|
||||
strbuf_addf(parsed, " --%s", o->long_name);
|
||||
if (arg) {
|
||||
strbuf_addch(parsed, ' ');
|
||||
sq_quote_buf(parsed, arg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *skipspaces(const char *s)
|
||||
{
|
||||
while (isspace(*s))
|
||||
s++;
|
||||
return s;
|
||||
}
|
||||
|
||||
static int cmd_parseopt(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
static int keep_dashdash = 0;
|
||||
static char const * const parseopt_usage[] = {
|
||||
"git-rev-parse --parseopt [options] -- [<args>...]",
|
||||
NULL
|
||||
};
|
||||
static struct option parseopt_opts[] = {
|
||||
OPT_BOOLEAN(0, "keep-dashdash", &keep_dashdash,
|
||||
"keep the `--` passed as an arg"),
|
||||
OPT_END(),
|
||||
};
|
||||
|
||||
struct strbuf sb, parsed;
|
||||
const char **usage = NULL;
|
||||
struct option *opts = NULL;
|
||||
int onb = 0, osz = 0, unb = 0, usz = 0;
|
||||
|
||||
strbuf_init(&parsed, 0);
|
||||
strbuf_addstr(&parsed, "set --");
|
||||
argc = parse_options(argc, argv, parseopt_opts, parseopt_usage,
|
||||
PARSE_OPT_KEEP_DASHDASH);
|
||||
if (argc < 1 || strcmp(argv[0], "--"))
|
||||
usage_with_options(parseopt_usage, parseopt_opts);
|
||||
|
||||
strbuf_init(&sb, 0);
|
||||
/* get the usage up to the first line with a -- on it */
|
||||
for (;;) {
|
||||
if (strbuf_getline(&sb, stdin, '\n') == EOF)
|
||||
die("premature end of input");
|
||||
ALLOC_GROW(usage, unb + 1, usz);
|
||||
if (!strcmp("--", sb.buf)) {
|
||||
if (unb < 1)
|
||||
die("no usage string given before the `--' separator");
|
||||
usage[unb] = NULL;
|
||||
break;
|
||||
}
|
||||
usage[unb++] = strbuf_detach(&sb, NULL);
|
||||
}
|
||||
|
||||
/* parse: (<short>|<short>,<long>|<long>)[=?]? SP+ <help> */
|
||||
while (strbuf_getline(&sb, stdin, '\n') != EOF) {
|
||||
const char *s;
|
||||
struct option *o;
|
||||
|
||||
if (!sb.len)
|
||||
continue;
|
||||
|
||||
ALLOC_GROW(opts, onb + 1, osz);
|
||||
memset(opts + onb, 0, sizeof(opts[onb]));
|
||||
|
||||
o = &opts[onb++];
|
||||
s = strchr(sb.buf, ' ');
|
||||
if (!s || *sb.buf == ' ') {
|
||||
o->type = OPTION_GROUP;
|
||||
o->help = xstrdup(skipspaces(s));
|
||||
continue;
|
||||
}
|
||||
|
||||
o->type = OPTION_CALLBACK;
|
||||
o->help = xstrdup(skipspaces(s));
|
||||
o->value = &parsed;
|
||||
o->callback = &parseopt_dump;
|
||||
switch (s[-1]) {
|
||||
case '=':
|
||||
s--;
|
||||
break;
|
||||
case '?':
|
||||
o->flags = PARSE_OPT_OPTARG;
|
||||
s--;
|
||||
break;
|
||||
default:
|
||||
o->flags = PARSE_OPT_NOARG;
|
||||
break;
|
||||
}
|
||||
|
||||
if (s - sb.buf == 1) /* short option only */
|
||||
o->short_name = *sb.buf;
|
||||
else if (sb.buf[1] != ',') /* long option only */
|
||||
o->long_name = xmemdupz(sb.buf, s - sb.buf);
|
||||
else {
|
||||
o->short_name = *sb.buf;
|
||||
o->long_name = xmemdupz(sb.buf + 2, s - sb.buf - 2);
|
||||
}
|
||||
}
|
||||
strbuf_release(&sb);
|
||||
|
||||
/* put an OPT_END() */
|
||||
ALLOC_GROW(opts, onb + 1, osz);
|
||||
memset(opts + onb, 0, sizeof(opts[onb]));
|
||||
argc = parse_options(argc, argv, opts, usage,
|
||||
keep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0);
|
||||
|
||||
strbuf_addf(&parsed, " --");
|
||||
sq_quote_argv(&parsed, argv, argc, 0);
|
||||
puts(parsed.buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cmd_rev_parse(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
int i, as_is = 0, verify = 0;
|
||||
unsigned char sha1[20];
|
||||
|
||||
git_config(git_default_config);
|
||||
if (argc > 1 && !strcmp("--parseopt", argv[1]))
|
||||
return cmd_parseopt(argc - 1, argv + 1, prefix);
|
||||
|
||||
prefix = setup_git_directory();
|
||||
git_config(git_default_config);
|
||||
for (i = 1; i < argc; i++) {
|
||||
const char *arg = argv[i];
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ extern int cmd_ls_tree(int argc, const char **argv, const char *prefix);
|
||||
extern int cmd_mailinfo(int argc, const char **argv, const char *prefix);
|
||||
extern int cmd_mailsplit(int argc, const char **argv, const char *prefix);
|
||||
extern int cmd_merge_base(int argc, const char **argv, const char *prefix);
|
||||
extern int cmd_merge_ours(int argc, const char **argv, const char *prefix);
|
||||
extern int cmd_merge_file(int argc, const char **argv, const char *prefix);
|
||||
extern int cmd_mv(int argc, const char **argv, const char *prefix);
|
||||
extern int cmd_name_rev(int argc, const char **argv, const char *prefix);
|
||||
|
||||
9
bundle.c
9
bundle.c
@@ -6,6 +6,7 @@
|
||||
#include "revision.h"
|
||||
#include "list-objects.h"
|
||||
#include "run-command.h"
|
||||
#include "refs.h"
|
||||
|
||||
static const char bundle_signature[] = "# v2 git bundle\n";
|
||||
|
||||
@@ -232,11 +233,17 @@ int create_bundle(struct bundle_header *header, const char *path,
|
||||
struct object_array_entry *e = revs.pending.objects + i;
|
||||
unsigned char sha1[20];
|
||||
char *ref;
|
||||
const char *display_ref;
|
||||
int flag;
|
||||
|
||||
if (e->item->flags & UNINTERESTING)
|
||||
continue;
|
||||
if (dwim_ref(e->name, strlen(e->name), sha1, &ref) != 1)
|
||||
continue;
|
||||
if (!resolve_ref(e->name, sha1, 1, &flag))
|
||||
flag = 0;
|
||||
display_ref = (flag & REF_ISSYMREF) ? e->name : ref;
|
||||
|
||||
/*
|
||||
* Make sure the refs we wrote out is correct; --max-count and
|
||||
* other limiting options could have prevented all the tips
|
||||
@@ -287,7 +294,7 @@ int create_bundle(struct bundle_header *header, const char *path,
|
||||
ref_count++;
|
||||
write_or_die(bundle_fd, sha1_to_hex(e->item->sha1), 40);
|
||||
write_or_die(bundle_fd, " ", 1);
|
||||
write_or_die(bundle_fd, ref, strlen(ref));
|
||||
write_or_die(bundle_fd, display_ref, strlen(display_ref));
|
||||
write_or_die(bundle_fd, "\n", 1);
|
||||
free(ref);
|
||||
}
|
||||
|
||||
@@ -664,7 +664,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
||||
int mode_differs = 0;
|
||||
int i, show_hunks;
|
||||
int working_tree_file = is_null_sha1(elem->sha1);
|
||||
int abbrev = opt->full_index ? 40 : DEFAULT_ABBREV;
|
||||
int abbrev = DIFF_OPT_TST(opt, FULL_INDEX) ? 40 : DEFAULT_ABBREV;
|
||||
mmfile_t result_file;
|
||||
|
||||
context = opt->context;
|
||||
@@ -784,7 +784,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
||||
|
||||
if (show_hunks || mode_differs || working_tree_file) {
|
||||
const char *abb;
|
||||
int use_color = opt->color_diff;
|
||||
int use_color = DIFF_OPT_TST(opt, COLOR_DIFF);
|
||||
const char *c_meta = diff_get_color(use_color, DIFF_METAINFO);
|
||||
const char *c_reset = diff_get_color(use_color, DIFF_RESET);
|
||||
int added = 0;
|
||||
@@ -836,7 +836,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
||||
dump_quoted_path("+++ /dev/", "null", c_meta, c_reset);
|
||||
else
|
||||
dump_quoted_path("+++ b/", elem->path, c_meta, c_reset);
|
||||
dump_sline(sline, cnt, num_parent, opt->color_diff);
|
||||
dump_sline(sline, cnt, num_parent, DIFF_OPT_TST(opt, COLOR_DIFF));
|
||||
}
|
||||
free(result);
|
||||
|
||||
@@ -929,8 +929,8 @@ void diff_tree_combined(const unsigned char *sha1,
|
||||
|
||||
diffopts = *opt;
|
||||
diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||
diffopts.recursive = 1;
|
||||
diffopts.allow_external = 0;
|
||||
DIFF_OPT_SET(&diffopts, RECURSIVE);
|
||||
DIFF_OPT_CLR(&diffopts, ALLOW_EXTERNAL);
|
||||
|
||||
show_log_first = !!rev->loginfo && !rev->no_commit_id;
|
||||
needsep = 0;
|
||||
|
||||
148
commit.c
148
commit.c
@@ -8,22 +8,6 @@
|
||||
|
||||
int save_commit_buffer = 1;
|
||||
|
||||
struct sort_node
|
||||
{
|
||||
/*
|
||||
* the number of children of the associated commit
|
||||
* that also occur in the list being sorted.
|
||||
*/
|
||||
unsigned int indegree;
|
||||
|
||||
/*
|
||||
* reference to original list item that we will re-use
|
||||
* on output.
|
||||
*/
|
||||
struct commit_list * list_item;
|
||||
|
||||
};
|
||||
|
||||
const char *commit_type = "commit";
|
||||
|
||||
static struct commit *check_commit(struct object *obj,
|
||||
@@ -431,69 +415,38 @@ struct commit *pop_commit(struct commit_list **stack)
|
||||
return item;
|
||||
}
|
||||
|
||||
void topo_sort_default_setter(struct commit *c, void *data)
|
||||
{
|
||||
c->util = data;
|
||||
}
|
||||
|
||||
void *topo_sort_default_getter(struct commit *c)
|
||||
{
|
||||
return c->util;
|
||||
}
|
||||
|
||||
/*
|
||||
* Performs an in-place topological sort on the list supplied.
|
||||
*/
|
||||
void sort_in_topological_order(struct commit_list ** list, int lifo)
|
||||
{
|
||||
sort_in_topological_order_fn(list, lifo, topo_sort_default_setter,
|
||||
topo_sort_default_getter);
|
||||
}
|
||||
struct commit_list *next, *orig = *list;
|
||||
struct commit_list *work, **insert;
|
||||
struct commit_list **pptr;
|
||||
|
||||
void sort_in_topological_order_fn(struct commit_list ** list, int lifo,
|
||||
topo_sort_set_fn_t setter,
|
||||
topo_sort_get_fn_t getter)
|
||||
{
|
||||
struct commit_list * next = *list;
|
||||
struct commit_list * work = NULL, **insert;
|
||||
struct commit_list ** pptr = list;
|
||||
struct sort_node * nodes;
|
||||
struct sort_node * next_nodes;
|
||||
int count = 0;
|
||||
|
||||
/* determine the size of the list */
|
||||
while (next) {
|
||||
next = next->next;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (!count)
|
||||
if (!orig)
|
||||
return;
|
||||
/* allocate an array to help sort the list */
|
||||
nodes = xcalloc(count, sizeof(*nodes));
|
||||
/* link the list to the array */
|
||||
next_nodes = nodes;
|
||||
next=*list;
|
||||
while (next) {
|
||||
next_nodes->list_item = next;
|
||||
setter(next->item, next_nodes);
|
||||
next_nodes++;
|
||||
next = next->next;
|
||||
*list = NULL;
|
||||
|
||||
/* Mark them and clear the indegree */
|
||||
for (next = orig; next; next = next->next) {
|
||||
struct commit *commit = next->item;
|
||||
commit->object.flags |= TOPOSORT;
|
||||
commit->indegree = 0;
|
||||
}
|
||||
|
||||
/* update the indegree */
|
||||
next=*list;
|
||||
while (next) {
|
||||
for (next = orig; next; next = next->next) {
|
||||
struct commit_list * parents = next->item->parents;
|
||||
while (parents) {
|
||||
struct commit * parent=parents->item;
|
||||
struct sort_node * pn = (struct sort_node *) getter(parent);
|
||||
struct commit *parent = parents->item;
|
||||
|
||||
if (pn)
|
||||
pn->indegree++;
|
||||
parents=parents->next;
|
||||
if (parent->object.flags & TOPOSORT)
|
||||
parent->indegree++;
|
||||
parents = parents->next;
|
||||
}
|
||||
next=next->next;
|
||||
}
|
||||
|
||||
/*
|
||||
* find the tips
|
||||
*
|
||||
@@ -501,55 +454,56 @@ void sort_in_topological_order_fn(struct commit_list ** list, int lifo,
|
||||
*
|
||||
* the tips serve as a starting set for the work queue.
|
||||
*/
|
||||
next=*list;
|
||||
work = NULL;
|
||||
insert = &work;
|
||||
while (next) {
|
||||
struct sort_node * node = (struct sort_node *) getter(next->item);
|
||||
for (next = orig; next; next = next->next) {
|
||||
struct commit *commit = next->item;
|
||||
|
||||
if (node->indegree == 0) {
|
||||
insert = &commit_list_insert(next->item, insert)->next;
|
||||
}
|
||||
next=next->next;
|
||||
if (!commit->indegree)
|
||||
insert = &commit_list_insert(commit, insert)->next;
|
||||
}
|
||||
|
||||
/* process the list in topological order */
|
||||
if (!lifo)
|
||||
sort_by_date(&work);
|
||||
|
||||
pptr = list;
|
||||
*list = NULL;
|
||||
while (work) {
|
||||
struct commit * work_item = pop_commit(&work);
|
||||
struct sort_node * work_node = (struct sort_node *) getter(work_item);
|
||||
struct commit_list * parents = work_item->parents;
|
||||
struct commit *commit;
|
||||
struct commit_list *parents, *work_item;
|
||||
|
||||
while (parents) {
|
||||
struct commit * parent=parents->item;
|
||||
struct sort_node * pn = (struct sort_node *) getter(parent);
|
||||
work_item = work;
|
||||
work = work_item->next;
|
||||
work_item->next = NULL;
|
||||
|
||||
if (pn) {
|
||||
/*
|
||||
* parents are only enqueued for emission
|
||||
* when all their children have been emitted thereby
|
||||
* guaranteeing topological order.
|
||||
*/
|
||||
pn->indegree--;
|
||||
if (!pn->indegree) {
|
||||
if (!lifo)
|
||||
insert_by_date(parent, &work);
|
||||
else
|
||||
commit_list_insert(parent, &work);
|
||||
}
|
||||
commit = work_item->item;
|
||||
for (parents = commit->parents; parents ; parents = parents->next) {
|
||||
struct commit *parent=parents->item;
|
||||
|
||||
if (!(parent->object.flags & TOPOSORT))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* parents are only enqueued for emission
|
||||
* when all their children have been emitted thereby
|
||||
* guaranteeing topological order.
|
||||
*/
|
||||
if (!--parent->indegree) {
|
||||
if (!lifo)
|
||||
insert_by_date(parent, &work);
|
||||
else
|
||||
commit_list_insert(parent, &work);
|
||||
}
|
||||
parents=parents->next;
|
||||
}
|
||||
/*
|
||||
* work_item is a commit all of whose children
|
||||
* have already been emitted. we can emit it now.
|
||||
*/
|
||||
*pptr = work_node->list_item;
|
||||
pptr = &(*pptr)->next;
|
||||
*pptr = NULL;
|
||||
setter(work_item, NULL);
|
||||
commit->object.flags &= ~TOPOSORT;
|
||||
*pptr = work_item;
|
||||
pptr = &work_item->next;
|
||||
}
|
||||
free(nodes);
|
||||
}
|
||||
|
||||
/* merge-base stuff */
|
||||
|
||||
25
commit.h
25
commit.h
@@ -14,6 +14,7 @@ struct commit_list {
|
||||
struct commit {
|
||||
struct object object;
|
||||
void *util;
|
||||
unsigned int indegree;
|
||||
unsigned long date;
|
||||
struct commit_list *parents;
|
||||
struct tree *tree;
|
||||
@@ -84,31 +85,12 @@ void clear_commit_marks(struct commit *commit, unsigned int mark);
|
||||
/*
|
||||
* Performs an in-place topological sort of list supplied.
|
||||
*
|
||||
* Pre-conditions for sort_in_topological_order:
|
||||
* all commits in input list and all parents of those
|
||||
* commits must have object.util == NULL
|
||||
*
|
||||
* Pre-conditions for sort_in_topological_order_fn:
|
||||
* all commits in input list and all parents of those
|
||||
* commits must have getter(commit) == NULL
|
||||
*
|
||||
* Post-conditions:
|
||||
* invariant of resulting list is:
|
||||
* a reachable from b => ord(b) < ord(a)
|
||||
* in addition, when lifo == 0, commits on parallel tracks are
|
||||
* sorted in the dates order.
|
||||
*/
|
||||
|
||||
typedef void (*topo_sort_set_fn_t)(struct commit*, void *data);
|
||||
typedef void* (*topo_sort_get_fn_t)(struct commit*);
|
||||
|
||||
void topo_sort_default_setter(struct commit *c, void *data);
|
||||
void *topo_sort_default_getter(struct commit *c);
|
||||
|
||||
void sort_in_topological_order(struct commit_list ** list, int lifo);
|
||||
void sort_in_topological_order_fn(struct commit_list ** list, int lifo,
|
||||
topo_sort_set_fn_t setter,
|
||||
topo_sort_get_fn_t getter);
|
||||
|
||||
struct commit_graft {
|
||||
unsigned char sha1[20];
|
||||
@@ -135,4 +117,9 @@ extern int interactive_add(void);
|
||||
extern void add_files_to_cache(int verbose, const char *prefix, const char **files);
|
||||
extern int rerere(void);
|
||||
|
||||
static inline int single_parent(struct commit *commit)
|
||||
{
|
||||
return commit->parents && !commit->parents->next;
|
||||
}
|
||||
|
||||
#endif /* COMMIT_H */
|
||||
|
||||
@@ -35,7 +35,10 @@ NO_SOCKADDR_STORAGE=@NO_SOCKADDR_STORAGE@
|
||||
NO_IPV6=@NO_IPV6@
|
||||
NO_C99_FORMAT=@NO_C99_FORMAT@
|
||||
NO_STRCASESTR=@NO_STRCASESTR@
|
||||
NO_MEMMEM=@NO_MEMMEM@
|
||||
NO_STRLCPY=@NO_STRLCPY@
|
||||
NO_STRTOUMAX=@NO_STRTOUMAX@
|
||||
NO_SETENV=@NO_SETENV@
|
||||
NO_MKDTEMP=@NO_MKDTEMP@
|
||||
NO_ICONV=@NO_ICONV@
|
||||
NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
|
||||
|
||||
18
configure.ac
18
configure.ac
@@ -289,18 +289,36 @@ AC_CHECK_FUNC(strcasestr,
|
||||
[NO_STRCASESTR=YesPlease])
|
||||
AC_SUBST(NO_STRCASESTR)
|
||||
#
|
||||
# Define NO_MEMMEM if you don't have memmem.
|
||||
AC_CHECK_FUNC(memmem,
|
||||
[NO_MEMMEM=],
|
||||
[NO_MEMMEM=YesPlease])
|
||||
AC_SUBST(NO_MEMMEM)
|
||||
#
|
||||
# Define NO_STRLCPY if you don't have strlcpy.
|
||||
AC_CHECK_FUNC(strlcpy,
|
||||
[NO_STRLCPY=],
|
||||
[NO_STRLCPY=YesPlease])
|
||||
AC_SUBST(NO_STRLCPY)
|
||||
#
|
||||
# Define NO_STRTOUMAX if you don't have strtoumax in the C library.
|
||||
AC_CHECK_FUNC(strtoumax,
|
||||
[NO_STRTOUMAX=],
|
||||
[NO_STRTOUMAX=YesPlease])
|
||||
AC_SUBST(NO_STRTOUMAX)
|
||||
#
|
||||
# Define NO_SETENV if you don't have setenv in the C library.
|
||||
AC_CHECK_FUNC(setenv,
|
||||
[NO_SETENV=],
|
||||
[NO_SETENV=YesPlease])
|
||||
AC_SUBST(NO_SETENV)
|
||||
#
|
||||
# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
|
||||
AC_CHECK_FUNC(mkdtemp,
|
||||
[NO_MKDTEMP=],
|
||||
[NO_MKDTEMP=YesPlease])
|
||||
AC_SUBST(NO_MKDTEMP)
|
||||
#
|
||||
# Define NO_MMAP if you want to avoid mmap.
|
||||
#
|
||||
# Define NO_ICONV if your libc does not properly support iconv.
|
||||
|
||||
@@ -1141,7 +1141,7 @@ class P4Sync(Command):
|
||||
|
||||
l = p4CmdList("labels %s..." % ' '.join (self.depotPaths))
|
||||
if len(l) > 0 and not self.silent:
|
||||
print "Finding files belonging to labels in %s" % `self.depotPath`
|
||||
print "Finding files belonging to labels in %s" % `self.depotPaths`
|
||||
|
||||
for output in l:
|
||||
label = output["label"]
|
||||
@@ -1207,6 +1207,15 @@ class P4Sync(Command):
|
||||
for branch in lostAndFoundBranches:
|
||||
self.knownBranches[branch] = branch
|
||||
|
||||
def getBranchMappingFromGitBranches(self):
|
||||
branches = p4BranchesInGit(self.importIntoRemotes)
|
||||
for branch in branches.keys():
|
||||
if branch == "master":
|
||||
branch = "main"
|
||||
else:
|
||||
branch = branch[len(self.projectName):]
|
||||
self.knownBranches[branch] = branch
|
||||
|
||||
def listExistingP4GitBranches(self):
|
||||
# branches holds mapping from name to commit
|
||||
branches = p4BranchesInGit(self.importIntoRemotes)
|
||||
@@ -1541,8 +1550,10 @@ class P4Sync(Command):
|
||||
## FIXME - what's a P4 projectName ?
|
||||
self.projectName = self.guessProjectName()
|
||||
|
||||
if not self.hasOrigin:
|
||||
self.getBranchMapping();
|
||||
if self.hasOrigin:
|
||||
self.getBranchMappingFromGitBranches()
|
||||
else:
|
||||
self.getBranchMapping()
|
||||
if self.verbose:
|
||||
print "p4-git branches: %s" % self.p4BranchesInGit
|
||||
print "initial parents: %s" % self.initialParents
|
||||
|
||||
@@ -27,20 +27,17 @@ import math
|
||||
import string
|
||||
import fcntl
|
||||
|
||||
have_gtksourceview2 = False
|
||||
have_gtksourceview = False
|
||||
try:
|
||||
import gtksourceview2
|
||||
have_gtksourceview2 = True
|
||||
except ImportError:
|
||||
have_gtksourceview2 = False
|
||||
|
||||
try:
|
||||
import gtksourceview
|
||||
have_gtksourceview = True
|
||||
except ImportError:
|
||||
have_gtksourceview = False
|
||||
|
||||
if not have_gtksourceview2 and not have_gtksourceview:
|
||||
print "Running without gtksourceview2 or gtksourceview module"
|
||||
try:
|
||||
import gtksourceview
|
||||
have_gtksourceview = True
|
||||
except ImportError:
|
||||
print "Running without gtksourceview2 or gtksourceview module"
|
||||
|
||||
re_ident = re.compile('(author|committer) (?P<ident>.*) (?P<epoch>\d+) (?P<tz>[+-]\d{4})')
|
||||
|
||||
|
||||
24
diff-lib.c
24
diff-lib.c
@@ -121,7 +121,7 @@ static int queue_diff(struct diff_options *o,
|
||||
} else {
|
||||
struct diff_filespec *d1, *d2;
|
||||
|
||||
if (o->reverse_diff) {
|
||||
if (DIFF_OPT_TST(o, REVERSE_DIFF)) {
|
||||
unsigned tmp;
|
||||
const char *tmp_c;
|
||||
tmp = mode1; mode1 = mode2; mode2 = tmp;
|
||||
@@ -189,8 +189,8 @@ static int handle_diff_files_args(struct rev_info *revs,
|
||||
else if (!strcmp(argv[1], "-n") ||
|
||||
!strcmp(argv[1], "--no-index")) {
|
||||
revs->max_count = -2;
|
||||
revs->diffopt.exit_with_status = 1;
|
||||
revs->diffopt.no_index = 1;
|
||||
DIFF_OPT_SET(&revs->diffopt, EXIT_WITH_STATUS);
|
||||
DIFF_OPT_SET(&revs->diffopt, NO_INDEX);
|
||||
}
|
||||
else if (!strcmp(argv[1], "-q"))
|
||||
*options |= DIFF_SILENT_ON_REMOVED;
|
||||
@@ -208,7 +208,7 @@ static int handle_diff_files_args(struct rev_info *revs,
|
||||
if (!is_in_index(revs->diffopt.paths[0]) ||
|
||||
!is_in_index(revs->diffopt.paths[1])) {
|
||||
revs->max_count = -2;
|
||||
revs->diffopt.no_index = 1;
|
||||
DIFF_OPT_SET(&revs->diffopt, NO_INDEX);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ int setup_diff_no_index(struct rev_info *revs,
|
||||
break;
|
||||
} else if (i < argc - 3 && !strcmp(argv[i], "--no-index")) {
|
||||
i = argc - 3;
|
||||
revs->diffopt.exit_with_status = 1;
|
||||
DIFF_OPT_SET(&revs->diffopt, EXIT_WITH_STATUS);
|
||||
break;
|
||||
}
|
||||
if (argc != i + 2 || (!is_outside_repo(argv[i + 1], nongit, prefix) &&
|
||||
@@ -297,7 +297,7 @@ int setup_diff_no_index(struct rev_info *revs,
|
||||
else
|
||||
revs->diffopt.paths = argv + argc - 2;
|
||||
revs->diffopt.nr_paths = 2;
|
||||
revs->diffopt.no_index = 1;
|
||||
DIFF_OPT_SET(&revs->diffopt, NO_INDEX);
|
||||
revs->max_count = -2;
|
||||
if (diff_setup_done(&revs->diffopt) < 0)
|
||||
die("diff_setup_done failed");
|
||||
@@ -311,7 +311,7 @@ int run_diff_files_cmd(struct rev_info *revs, int argc, const char **argv)
|
||||
if (handle_diff_files_args(revs, argc, argv, &options))
|
||||
return -1;
|
||||
|
||||
if (revs->diffopt.no_index) {
|
||||
if (DIFF_OPT_TST(&revs->diffopt, NO_INDEX)) {
|
||||
if (revs->diffopt.nr_paths != 2)
|
||||
return error("need two files/directories with --no-index");
|
||||
if (queue_diff(&revs->diffopt, revs->diffopt.paths[0],
|
||||
@@ -350,7 +350,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
||||
struct cache_entry *ce = active_cache[i];
|
||||
int changed;
|
||||
|
||||
if (revs->diffopt.quiet && revs->diffopt.has_changes)
|
||||
if (DIFF_OPT_TST(&revs->diffopt, QUIET) &&
|
||||
DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
|
||||
break;
|
||||
|
||||
if (!ce_path_match(ce, revs->prune_data))
|
||||
@@ -446,7 +447,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
||||
continue;
|
||||
}
|
||||
changed = ce_match_stat(ce, &st, ce_option);
|
||||
if (!changed && !revs->diffopt.find_copies_harder)
|
||||
if (!changed && !DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER))
|
||||
continue;
|
||||
oldmode = ntohl(ce->ce_mode);
|
||||
newmode = ntohl(ce_mode_from_stat(ce, st.st_mode));
|
||||
@@ -565,7 +566,7 @@ static int show_modified(struct rev_info *revs,
|
||||
|
||||
oldmode = old->ce_mode;
|
||||
if (mode == oldmode && !hashcmp(sha1, old->sha1) &&
|
||||
!revs->diffopt.find_copies_harder)
|
||||
!DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER))
|
||||
return 0;
|
||||
|
||||
mode = ntohl(mode);
|
||||
@@ -585,7 +586,8 @@ static int diff_cache(struct rev_info *revs,
|
||||
struct cache_entry *ce = *ac;
|
||||
int same = (entries > 1) && ce_same_name(ce, ac[1]);
|
||||
|
||||
if (revs->diffopt.quiet && revs->diffopt.has_changes)
|
||||
if (DIFF_OPT_TST(&revs->diffopt, QUIET) &&
|
||||
DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
|
||||
break;
|
||||
|
||||
if (!ce_path_match(ce, pathspec))
|
||||
|
||||
223
diff.c
223
diff.c
@@ -814,10 +814,10 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
|
||||
}
|
||||
|
||||
/* Find the longest filename and max number of changes */
|
||||
reset = diff_get_color(options->color_diff, DIFF_RESET);
|
||||
set = diff_get_color(options->color_diff, DIFF_PLAIN);
|
||||
add_c = diff_get_color(options->color_diff, DIFF_FILE_NEW);
|
||||
del_c = diff_get_color(options->color_diff, DIFF_FILE_OLD);
|
||||
reset = diff_get_color_opt(options, DIFF_RESET);
|
||||
set = diff_get_color_opt(options, DIFF_PLAIN);
|
||||
add_c = diff_get_color_opt(options, DIFF_FILE_NEW);
|
||||
del_c = diff_get_color_opt(options, DIFF_FILE_OLD);
|
||||
|
||||
for (i = 0; i < data->nr; i++) {
|
||||
struct diffstat_file *file = data->files[i];
|
||||
@@ -1243,8 +1243,8 @@ static void builtin_diff(const char *name_a,
|
||||
mmfile_t mf1, mf2;
|
||||
const char *lbl[2];
|
||||
char *a_one, *b_two;
|
||||
const char *set = diff_get_color(o->color_diff, DIFF_METAINFO);
|
||||
const char *reset = diff_get_color(o->color_diff, DIFF_RESET);
|
||||
const char *set = diff_get_color_opt(o, DIFF_METAINFO);
|
||||
const char *reset = diff_get_color_opt(o, DIFF_RESET);
|
||||
|
||||
a_one = quote_two("a/", name_a + (*name_a == '/'));
|
||||
b_two = quote_two("b/", name_b + (*name_b == '/'));
|
||||
@@ -1277,7 +1277,7 @@ static void builtin_diff(const char *name_a,
|
||||
goto free_ab_and_return;
|
||||
if (complete_rewrite) {
|
||||
emit_rewrite_diff(name_a, name_b, one, two,
|
||||
o->color_diff);
|
||||
DIFF_OPT_TST(o, COLOR_DIFF));
|
||||
o->found_changes = 1;
|
||||
goto free_ab_and_return;
|
||||
}
|
||||
@@ -1286,13 +1286,13 @@ static void builtin_diff(const char *name_a,
|
||||
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
|
||||
die("unable to read files to diff");
|
||||
|
||||
if (!o->text &&
|
||||
if (!DIFF_OPT_TST(o, TEXT) &&
|
||||
(diff_filespec_is_binary(one) || diff_filespec_is_binary(two))) {
|
||||
/* Quite common confusing case */
|
||||
if (mf1.size == mf2.size &&
|
||||
!memcmp(mf1.ptr, mf2.ptr, mf1.size))
|
||||
goto free_ab_and_return;
|
||||
if (o->binary)
|
||||
if (DIFF_OPT_TST(o, BINARY))
|
||||
emit_binary_diff(&mf1, &mf2);
|
||||
else
|
||||
printf("Binary files %s and %s differ\n",
|
||||
@@ -1315,7 +1315,7 @@ static void builtin_diff(const char *name_a,
|
||||
memset(&xecfg, 0, sizeof(xecfg));
|
||||
memset(&ecbdata, 0, sizeof(ecbdata));
|
||||
ecbdata.label_path = lbl;
|
||||
ecbdata.color_diff = o->color_diff;
|
||||
ecbdata.color_diff = DIFF_OPT_TST(o, COLOR_DIFF);
|
||||
ecbdata.found_changesp = &o->found_changes;
|
||||
xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;
|
||||
xecfg.ctxlen = o->context;
|
||||
@@ -1331,11 +1331,11 @@ static void builtin_diff(const char *name_a,
|
||||
ecb.outf = xdiff_outf;
|
||||
ecb.priv = &ecbdata;
|
||||
ecbdata.xm.consume = fn_out_consume;
|
||||
if (o->color_diff_words)
|
||||
if (DIFF_OPT_TST(o, COLOR_DIFF_WORDS))
|
||||
ecbdata.diff_words =
|
||||
xcalloc(1, sizeof(struct diff_words_data));
|
||||
xdl_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
|
||||
if (o->color_diff_words)
|
||||
if (DIFF_OPT_TST(o, COLOR_DIFF_WORDS))
|
||||
free_diff_words_data(&ecbdata);
|
||||
}
|
||||
|
||||
@@ -1409,7 +1409,7 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
|
||||
data.xm.consume = checkdiff_consume;
|
||||
data.filename = name_b ? name_b : name_a;
|
||||
data.lineno = 0;
|
||||
data.color_diff = o->color_diff;
|
||||
data.color_diff = DIFF_OPT_TST(o, COLOR_DIFF);
|
||||
|
||||
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
|
||||
die("unable to read files to diff");
|
||||
@@ -1853,7 +1853,7 @@ static void run_diff_cmd(const char *pgm,
|
||||
struct diff_options *o,
|
||||
int complete_rewrite)
|
||||
{
|
||||
if (!o->allow_external)
|
||||
if (!DIFF_OPT_TST(o, ALLOW_EXTERNAL))
|
||||
pgm = NULL;
|
||||
else {
|
||||
const char *cmd = external_diff_attr(name);
|
||||
@@ -1951,9 +1951,9 @@ static void run_diff(struct diff_filepair *p, struct diff_options *o)
|
||||
}
|
||||
|
||||
if (hashcmp(one->sha1, two->sha1)) {
|
||||
int abbrev = o->full_index ? 40 : DEFAULT_ABBREV;
|
||||
int abbrev = DIFF_OPT_TST(o, FULL_INDEX) ? 40 : DEFAULT_ABBREV;
|
||||
|
||||
if (o->binary) {
|
||||
if (DIFF_OPT_TST(o, BINARY)) {
|
||||
mmfile_t mf;
|
||||
if ((!fill_mmfile(&mf, one) && diff_filespec_is_binary(one)) ||
|
||||
(!fill_mmfile(&mf, two) && diff_filespec_is_binary(two)))
|
||||
@@ -2045,7 +2045,10 @@ void diff_setup(struct diff_options *options)
|
||||
|
||||
options->change = diff_change;
|
||||
options->add_remove = diff_addremove;
|
||||
options->color_diff = diff_use_color_default;
|
||||
if (diff_use_color_default)
|
||||
DIFF_OPT_SET(options, COLOR_DIFF);
|
||||
else
|
||||
DIFF_OPT_CLR(options, COLOR_DIFF);
|
||||
options->detect_rename = diff_detect_rename_default;
|
||||
}
|
||||
|
||||
@@ -2064,7 +2067,7 @@ int diff_setup_done(struct diff_options *options)
|
||||
if (count > 1)
|
||||
die("--name-only, --name-status, --check and -s are mutually exclusive");
|
||||
|
||||
if (options->find_copies_harder)
|
||||
if (DIFF_OPT_TST(options, FIND_COPIES_HARDER))
|
||||
options->detect_rename = DIFF_DETECT_COPY;
|
||||
|
||||
if (options->output_format & (DIFF_FORMAT_NAME |
|
||||
@@ -2088,12 +2091,12 @@ int diff_setup_done(struct diff_options *options)
|
||||
DIFF_FORMAT_SHORTSTAT |
|
||||
DIFF_FORMAT_SUMMARY |
|
||||
DIFF_FORMAT_CHECKDIFF))
|
||||
options->recursive = 1;
|
||||
DIFF_OPT_SET(options, RECURSIVE);
|
||||
/*
|
||||
* Also pickaxe would not work very well if you do not say recursive
|
||||
*/
|
||||
if (options->pickaxe)
|
||||
options->recursive = 1;
|
||||
DIFF_OPT_SET(options, RECURSIVE);
|
||||
|
||||
if (options->detect_rename && options->rename_limit < 0)
|
||||
options->rename_limit = diff_rename_limit_default;
|
||||
@@ -2115,9 +2118,9 @@ int diff_setup_done(struct diff_options *options)
|
||||
* to have found. It does not make sense not to return with
|
||||
* exit code in such a case either.
|
||||
*/
|
||||
if (options->quiet) {
|
||||
if (DIFF_OPT_TST(options, QUIET)) {
|
||||
options->output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||
options->exit_with_status = 1;
|
||||
DIFF_OPT_SET(options, EXIT_WITH_STATUS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2125,7 +2128,7 @@ int diff_setup_done(struct diff_options *options)
|
||||
* upon the first hit. We need to run diff as usual.
|
||||
*/
|
||||
if (options->pickaxe || options->filter)
|
||||
options->quiet = 0;
|
||||
DIFF_OPT_CLR(options, QUIET);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2182,21 +2185,32 @@ static int diff_scoreopt_parse(const char *opt);
|
||||
int diff_opt_parse(struct diff_options *options, const char **av, int ac)
|
||||
{
|
||||
const char *arg = av[0];
|
||||
|
||||
/* Output format options */
|
||||
if (!strcmp(arg, "-p") || !strcmp(arg, "-u"))
|
||||
options->output_format |= DIFF_FORMAT_PATCH;
|
||||
else if (opt_arg(arg, 'U', "unified", &options->context))
|
||||
options->output_format |= DIFF_FORMAT_PATCH;
|
||||
else if (!strcmp(arg, "--raw"))
|
||||
options->output_format |= DIFF_FORMAT_RAW;
|
||||
else if (!strcmp(arg, "--patch-with-raw")) {
|
||||
else if (!strcmp(arg, "--patch-with-raw"))
|
||||
options->output_format |= DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW;
|
||||
}
|
||||
else if (!strcmp(arg, "--numstat")) {
|
||||
else if (!strcmp(arg, "--numstat"))
|
||||
options->output_format |= DIFF_FORMAT_NUMSTAT;
|
||||
}
|
||||
else if (!strcmp(arg, "--shortstat")) {
|
||||
else if (!strcmp(arg, "--shortstat"))
|
||||
options->output_format |= DIFF_FORMAT_SHORTSTAT;
|
||||
}
|
||||
else if (!strcmp(arg, "--check"))
|
||||
options->output_format |= DIFF_FORMAT_CHECKDIFF;
|
||||
else if (!strcmp(arg, "--summary"))
|
||||
options->output_format |= DIFF_FORMAT_SUMMARY;
|
||||
else if (!strcmp(arg, "--patch-with-stat"))
|
||||
options->output_format |= DIFF_FORMAT_PATCH | DIFF_FORMAT_DIFFSTAT;
|
||||
else if (!strcmp(arg, "--name-only"))
|
||||
options->output_format |= DIFF_FORMAT_NAME;
|
||||
else if (!strcmp(arg, "--name-status"))
|
||||
options->output_format |= DIFF_FORMAT_NAME_STATUS;
|
||||
else if (!strcmp(arg, "-s"))
|
||||
options->output_format |= DIFF_FORMAT_NO_OUTPUT;
|
||||
else if (!prefixcmp(arg, "--stat")) {
|
||||
char *end;
|
||||
int width = options->stat_width;
|
||||
@@ -2224,68 +2238,80 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
|
||||
options->stat_name_width = name_width;
|
||||
options->stat_width = width;
|
||||
}
|
||||
else if (!strcmp(arg, "--check"))
|
||||
options->output_format |= DIFF_FORMAT_CHECKDIFF;
|
||||
else if (!strcmp(arg, "--summary"))
|
||||
options->output_format |= DIFF_FORMAT_SUMMARY;
|
||||
else if (!strcmp(arg, "--patch-with-stat")) {
|
||||
options->output_format |= DIFF_FORMAT_PATCH | DIFF_FORMAT_DIFFSTAT;
|
||||
}
|
||||
else if (!strcmp(arg, "-z"))
|
||||
options->line_termination = 0;
|
||||
else if (!prefixcmp(arg, "-l"))
|
||||
options->rename_limit = strtoul(arg+2, NULL, 10);
|
||||
else if (!strcmp(arg, "--full-index"))
|
||||
options->full_index = 1;
|
||||
else if (!strcmp(arg, "--binary")) {
|
||||
options->output_format |= DIFF_FORMAT_PATCH;
|
||||
options->binary = 1;
|
||||
}
|
||||
else if (!strcmp(arg, "-a") || !strcmp(arg, "--text")) {
|
||||
options->text = 1;
|
||||
}
|
||||
else if (!strcmp(arg, "--name-only"))
|
||||
options->output_format |= DIFF_FORMAT_NAME;
|
||||
else if (!strcmp(arg, "--name-status"))
|
||||
options->output_format |= DIFF_FORMAT_NAME_STATUS;
|
||||
else if (!strcmp(arg, "-R"))
|
||||
options->reverse_diff = 1;
|
||||
else if (!prefixcmp(arg, "-S"))
|
||||
options->pickaxe = arg + 2;
|
||||
else if (!strcmp(arg, "-s")) {
|
||||
options->output_format |= DIFF_FORMAT_NO_OUTPUT;
|
||||
}
|
||||
else if (!prefixcmp(arg, "-O"))
|
||||
options->orderfile = arg + 2;
|
||||
else if (!prefixcmp(arg, "--diff-filter="))
|
||||
options->filter = arg + 14;
|
||||
else if (!strcmp(arg, "--pickaxe-all"))
|
||||
options->pickaxe_opts = DIFF_PICKAXE_ALL;
|
||||
else if (!strcmp(arg, "--pickaxe-regex"))
|
||||
options->pickaxe_opts = DIFF_PICKAXE_REGEX;
|
||||
|
||||
/* renames options */
|
||||
else if (!prefixcmp(arg, "-B")) {
|
||||
if ((options->break_opt =
|
||||
diff_scoreopt_parse(arg)) == -1)
|
||||
if ((options->break_opt = diff_scoreopt_parse(arg)) == -1)
|
||||
return -1;
|
||||
}
|
||||
else if (!prefixcmp(arg, "-M")) {
|
||||
if ((options->rename_score =
|
||||
diff_scoreopt_parse(arg)) == -1)
|
||||
if ((options->rename_score = diff_scoreopt_parse(arg)) == -1)
|
||||
return -1;
|
||||
options->detect_rename = DIFF_DETECT_RENAME;
|
||||
}
|
||||
else if (!prefixcmp(arg, "-C")) {
|
||||
if (options->detect_rename == DIFF_DETECT_COPY)
|
||||
options->find_copies_harder = 1;
|
||||
if ((options->rename_score =
|
||||
diff_scoreopt_parse(arg)) == -1)
|
||||
DIFF_OPT_SET(options, FIND_COPIES_HARDER);
|
||||
if ((options->rename_score = diff_scoreopt_parse(arg)) == -1)
|
||||
return -1;
|
||||
options->detect_rename = DIFF_DETECT_COPY;
|
||||
}
|
||||
else if (!strcmp(arg, "--no-renames"))
|
||||
options->detect_rename = 0;
|
||||
|
||||
/* xdiff options */
|
||||
else if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space"))
|
||||
options->xdl_opts |= XDF_IGNORE_WHITESPACE;
|
||||
else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change"))
|
||||
options->xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE;
|
||||
else if (!strcmp(arg, "--ignore-space-at-eol"))
|
||||
options->xdl_opts |= XDF_IGNORE_WHITESPACE_AT_EOL;
|
||||
|
||||
/* flags options */
|
||||
else if (!strcmp(arg, "--binary")) {
|
||||
options->output_format |= DIFF_FORMAT_PATCH;
|
||||
DIFF_OPT_SET(options, BINARY);
|
||||
}
|
||||
else if (!strcmp(arg, "--full-index"))
|
||||
DIFF_OPT_SET(options, FULL_INDEX);
|
||||
else if (!strcmp(arg, "-a") || !strcmp(arg, "--text"))
|
||||
DIFF_OPT_SET(options, TEXT);
|
||||
else if (!strcmp(arg, "-R"))
|
||||
DIFF_OPT_SET(options, REVERSE_DIFF);
|
||||
else if (!strcmp(arg, "--find-copies-harder"))
|
||||
options->find_copies_harder = 1;
|
||||
DIFF_OPT_SET(options, FIND_COPIES_HARDER);
|
||||
else if (!strcmp(arg, "--follow"))
|
||||
options->follow_renames = 1;
|
||||
DIFF_OPT_SET(options, FOLLOW_RENAMES);
|
||||
else if (!strcmp(arg, "--color"))
|
||||
DIFF_OPT_SET(options, COLOR_DIFF);
|
||||
else if (!strcmp(arg, "--no-color"))
|
||||
DIFF_OPT_CLR(options, COLOR_DIFF);
|
||||
else if (!strcmp(arg, "--color-words"))
|
||||
options->flags |= DIFF_OPT_COLOR_DIFF | DIFF_OPT_COLOR_DIFF_WORDS;
|
||||
else if (!strcmp(arg, "--exit-code"))
|
||||
DIFF_OPT_SET(options, EXIT_WITH_STATUS);
|
||||
else if (!strcmp(arg, "--quiet"))
|
||||
DIFF_OPT_SET(options, QUIET);
|
||||
else if (!strcmp(arg, "--ext-diff"))
|
||||
DIFF_OPT_SET(options, ALLOW_EXTERNAL);
|
||||
else if (!strcmp(arg, "--no-ext-diff"))
|
||||
DIFF_OPT_CLR(options, ALLOW_EXTERNAL);
|
||||
|
||||
/* misc options */
|
||||
else if (!strcmp(arg, "-z"))
|
||||
options->line_termination = 0;
|
||||
else if (!prefixcmp(arg, "-l"))
|
||||
options->rename_limit = strtoul(arg+2, NULL, 10);
|
||||
else if (!prefixcmp(arg, "-S"))
|
||||
options->pickaxe = arg + 2;
|
||||
else if (!strcmp(arg, "--pickaxe-all"))
|
||||
options->pickaxe_opts = DIFF_PICKAXE_ALL;
|
||||
else if (!strcmp(arg, "--pickaxe-regex"))
|
||||
options->pickaxe_opts = DIFF_PICKAXE_REGEX;
|
||||
else if (!prefixcmp(arg, "-O"))
|
||||
options->orderfile = arg + 2;
|
||||
else if (!prefixcmp(arg, "--diff-filter="))
|
||||
options->filter = arg + 14;
|
||||
else if (!strcmp(arg, "--abbrev"))
|
||||
options->abbrev = DEFAULT_ABBREV;
|
||||
else if (!prefixcmp(arg, "--abbrev=")) {
|
||||
@@ -2295,28 +2321,6 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
|
||||
else if (40 < options->abbrev)
|
||||
options->abbrev = 40;
|
||||
}
|
||||
else if (!strcmp(arg, "--color"))
|
||||
options->color_diff = 1;
|
||||
else if (!strcmp(arg, "--no-color"))
|
||||
options->color_diff = 0;
|
||||
else if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space"))
|
||||
options->xdl_opts |= XDF_IGNORE_WHITESPACE;
|
||||
else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change"))
|
||||
options->xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE;
|
||||
else if (!strcmp(arg, "--ignore-space-at-eol"))
|
||||
options->xdl_opts |= XDF_IGNORE_WHITESPACE_AT_EOL;
|
||||
else if (!strcmp(arg, "--color-words"))
|
||||
options->color_diff = options->color_diff_words = 1;
|
||||
else if (!strcmp(arg, "--no-renames"))
|
||||
options->detect_rename = 0;
|
||||
else if (!strcmp(arg, "--exit-code"))
|
||||
options->exit_with_status = 1;
|
||||
else if (!strcmp(arg, "--quiet"))
|
||||
options->quiet = 1;
|
||||
else if (!strcmp(arg, "--ext-diff"))
|
||||
options->allow_external = 1;
|
||||
else if (!strcmp(arg, "--no-ext-diff"))
|
||||
options->allow_external = 0;
|
||||
else
|
||||
return 0;
|
||||
return 1;
|
||||
@@ -2712,7 +2716,7 @@ static void diff_summary(struct diff_filepair *p)
|
||||
break;
|
||||
default:
|
||||
if (p->score) {
|
||||
puts(" rewrite ");
|
||||
fputs(" rewrite ", stdout);
|
||||
write_name_quoted(p->two->path, stdout, ' ');
|
||||
printf("(%d%%)\n", similarity_index(p));
|
||||
}
|
||||
@@ -3071,7 +3075,7 @@ static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)
|
||||
* to determine how many paths were dirty only
|
||||
* due to stat info mismatch.
|
||||
*/
|
||||
if (!diffopt->no_index)
|
||||
if (!DIFF_OPT_TST(diffopt, NO_INDEX))
|
||||
diffopt->skip_stat_unmatch++;
|
||||
diff_free_filepair(p);
|
||||
}
|
||||
@@ -3082,10 +3086,10 @@ static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)
|
||||
|
||||
void diffcore_std(struct diff_options *options)
|
||||
{
|
||||
if (options->quiet)
|
||||
if (DIFF_OPT_TST(options, QUIET))
|
||||
return;
|
||||
|
||||
if (options->skip_stat_unmatch && !options->find_copies_harder)
|
||||
if (options->skip_stat_unmatch && !DIFF_OPT_TST(options, FIND_COPIES_HARDER))
|
||||
diffcore_skip_stat_unmatch(options);
|
||||
if (options->break_opt != -1)
|
||||
diffcore_break(options->break_opt);
|
||||
@@ -3100,7 +3104,10 @@ void diffcore_std(struct diff_options *options)
|
||||
diff_resolve_rename_copy();
|
||||
diffcore_apply_filter(options->filter);
|
||||
|
||||
options->has_changes = !!diff_queued_diff.nr;
|
||||
if (diff_queued_diff.nr)
|
||||
DIFF_OPT_SET(options, HAS_CHANGES);
|
||||
else
|
||||
DIFF_OPT_CLR(options, HAS_CHANGES);
|
||||
}
|
||||
|
||||
|
||||
@@ -3124,7 +3131,7 @@ void diff_addremove(struct diff_options *options,
|
||||
* Before the final output happens, they are pruned after
|
||||
* merged into rename/copy pairs as appropriate.
|
||||
*/
|
||||
if (options->reverse_diff)
|
||||
if (DIFF_OPT_TST(options, REVERSE_DIFF))
|
||||
addremove = (addremove == '+' ? '-' :
|
||||
addremove == '-' ? '+' : addremove);
|
||||
|
||||
@@ -3139,7 +3146,7 @@ void diff_addremove(struct diff_options *options,
|
||||
fill_filespec(two, sha1, mode);
|
||||
|
||||
diff_queue(&diff_queued_diff, one, two);
|
||||
options->has_changes = 1;
|
||||
DIFF_OPT_SET(options, HAS_CHANGES);
|
||||
}
|
||||
|
||||
void diff_change(struct diff_options *options,
|
||||
@@ -3151,7 +3158,7 @@ void diff_change(struct diff_options *options,
|
||||
char concatpath[PATH_MAX];
|
||||
struct diff_filespec *one, *two;
|
||||
|
||||
if (options->reverse_diff) {
|
||||
if (DIFF_OPT_TST(options, REVERSE_DIFF)) {
|
||||
unsigned tmp;
|
||||
const unsigned char *tmp_c;
|
||||
tmp = old_mode; old_mode = new_mode; new_mode = tmp;
|
||||
@@ -3165,7 +3172,7 @@ void diff_change(struct diff_options *options,
|
||||
fill_filespec(two, new_sha1, new_mode);
|
||||
|
||||
diff_queue(&diff_queued_diff, one, two);
|
||||
options->has_changes = 1;
|
||||
DIFF_OPT_SET(options, HAS_CHANGES);
|
||||
}
|
||||
|
||||
void diff_unmerge(struct diff_options *options,
|
||||
|
||||
40
diff.h
40
diff.h
@@ -43,26 +43,32 @@ typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
|
||||
|
||||
#define DIFF_FORMAT_CALLBACK 0x1000
|
||||
|
||||
#define DIFF_OPT_RECURSIVE (1 << 0)
|
||||
#define DIFF_OPT_TREE_IN_RECURSIVE (1 << 1)
|
||||
#define DIFF_OPT_BINARY (1 << 2)
|
||||
#define DIFF_OPT_TEXT (1 << 3)
|
||||
#define DIFF_OPT_FULL_INDEX (1 << 4)
|
||||
#define DIFF_OPT_SILENT_ON_REMOVE (1 << 5)
|
||||
#define DIFF_OPT_FIND_COPIES_HARDER (1 << 6)
|
||||
#define DIFF_OPT_FOLLOW_RENAMES (1 << 7)
|
||||
#define DIFF_OPT_COLOR_DIFF (1 << 8)
|
||||
#define DIFF_OPT_COLOR_DIFF_WORDS (1 << 9)
|
||||
#define DIFF_OPT_HAS_CHANGES (1 << 10)
|
||||
#define DIFF_OPT_QUIET (1 << 11)
|
||||
#define DIFF_OPT_NO_INDEX (1 << 12)
|
||||
#define DIFF_OPT_ALLOW_EXTERNAL (1 << 13)
|
||||
#define DIFF_OPT_EXIT_WITH_STATUS (1 << 14)
|
||||
#define DIFF_OPT_REVERSE_DIFF (1 << 15)
|
||||
#define DIFF_OPT_TST(opts, flag) ((opts)->flags & DIFF_OPT_##flag)
|
||||
#define DIFF_OPT_SET(opts, flag) ((opts)->flags |= DIFF_OPT_##flag)
|
||||
#define DIFF_OPT_CLR(opts, flag) ((opts)->flags &= ~DIFF_OPT_##flag)
|
||||
|
||||
struct diff_options {
|
||||
const char *filter;
|
||||
const char *orderfile;
|
||||
const char *pickaxe;
|
||||
const char *single_follow;
|
||||
unsigned recursive:1,
|
||||
tree_in_recursive:1,
|
||||
binary:1,
|
||||
text:1,
|
||||
full_index:1,
|
||||
silent_on_remove:1,
|
||||
find_copies_harder:1,
|
||||
follow_renames:1,
|
||||
color_diff:1,
|
||||
color_diff_words:1,
|
||||
has_changes:1,
|
||||
quiet:1,
|
||||
no_index:1,
|
||||
allow_external:1,
|
||||
exit_with_status:1;
|
||||
unsigned flags;
|
||||
int context;
|
||||
int break_opt;
|
||||
int detect_rename;
|
||||
@@ -71,7 +77,6 @@ struct diff_options {
|
||||
int output_format;
|
||||
int pickaxe_opts;
|
||||
int rename_score;
|
||||
int reverse_diff;
|
||||
int rename_limit;
|
||||
int setup;
|
||||
int abbrev;
|
||||
@@ -105,6 +110,9 @@ enum color_diff {
|
||||
DIFF_WHITESPACE = 7,
|
||||
};
|
||||
const char *diff_get_color(int diff_use_color, enum color_diff ix);
|
||||
#define diff_get_color_opt(o, ix) \
|
||||
diff_get_color(DIFF_OPT_TST((o), COLOR_DIFF), ix)
|
||||
|
||||
|
||||
extern const char mime_boundary_leader[];
|
||||
|
||||
|
||||
6
dir.c
6
dir.c
@@ -654,6 +654,7 @@ static void free_simplify(struct path_simplify *simplify)
|
||||
int read_directory(struct dir_struct *dir, const char *path, const char *base, int baselen, const char **pathspec)
|
||||
{
|
||||
struct path_simplify *simplify = create_simplify(pathspec);
|
||||
char *pp = NULL;
|
||||
|
||||
/*
|
||||
* Make sure to do the per-directory exclude for all the
|
||||
@@ -661,7 +662,8 @@ int read_directory(struct dir_struct *dir, const char *path, const char *base, i
|
||||
*/
|
||||
if (baselen) {
|
||||
if (dir->exclude_per_dir) {
|
||||
char *p, *pp = xmalloc(baselen+1);
|
||||
char *p;
|
||||
pp = xmalloc(baselen+1);
|
||||
memcpy(pp, base, baselen+1);
|
||||
p = pp;
|
||||
while (1) {
|
||||
@@ -677,12 +679,12 @@ int read_directory(struct dir_struct *dir, const char *path, const char *base, i
|
||||
else
|
||||
p = pp + baselen;
|
||||
}
|
||||
free(pp);
|
||||
}
|
||||
}
|
||||
|
||||
read_directory_recursive(dir, path, base, baselen, 0, simplify);
|
||||
free_simplify(simplify);
|
||||
free(pp);
|
||||
qsort(dir->entries, dir->nr, sizeof(struct dir_entry *), cmp_name);
|
||||
qsort(dir->ignored, dir->ignored_nr, sizeof(struct dir_entry *), cmp_name);
|
||||
return dir->nr;
|
||||
|
||||
@@ -37,10 +37,7 @@ sub list_untracked {
|
||||
chomp $_;
|
||||
$_;
|
||||
}
|
||||
run_cmd_pipe(qw(git ls-files --others
|
||||
--exclude-per-directory=.gitignore),
|
||||
"--exclude-from=$GIT_DIR/info/exclude",
|
||||
'--', @_);
|
||||
run_cmd_pipe(qw(git ls-files --others --exclude-standard --), @_);
|
||||
}
|
||||
|
||||
my $status_fmt = '%12s %12s %s';
|
||||
@@ -567,10 +564,12 @@ sub patch_update_cmd {
|
||||
IMMEDIATE => 1,
|
||||
HEADER => $status_head, },
|
||||
@mods);
|
||||
return if (!$it);
|
||||
patch_update_file($it->{VALUE}) if ($it);
|
||||
}
|
||||
|
||||
sub patch_update_file {
|
||||
my ($ix, $num);
|
||||
my $path = $it->{VALUE};
|
||||
my $path = shift;
|
||||
my ($head, @hunk) = parse_diff($path);
|
||||
for (@{$head->{TEXT}}) {
|
||||
print;
|
||||
|
||||
94
git-am.sh
94
git-am.sh
@@ -2,11 +2,26 @@
|
||||
#
|
||||
# Copyright (c) 2005, 2006 Junio C Hamano
|
||||
|
||||
USAGE='[--signoff] [--dotest=<dir>] [--keep] [--utf8 | --no-utf8]
|
||||
[--3way] [--interactive] [--binary]
|
||||
[--whitespace=<option>] [-C<n>] [-p<n>]
|
||||
<mbox>|<Maildir>...
|
||||
or, when resuming [--skip | --resolved]'
|
||||
OPTIONS_KEEPDASHDASH=
|
||||
OPTIONS_SPEC="\
|
||||
git-am [options] <mbox>|<Maildir>...
|
||||
git-am [options] --resolved
|
||||
git-am [options] --skip
|
||||
--
|
||||
d,dotest= use <dir> and not .dotest
|
||||
i,interactive run interactively
|
||||
b,binary pass --allo-binary-replacement to git-apply
|
||||
3,3way allow fall back on 3way merging if needed
|
||||
s,signoff add a Signed-off-by line to the commit message
|
||||
u,utf8 recode into utf8 (default)
|
||||
k,keep pass -k flagg to git-mailinfo
|
||||
whitespace= pass it through git-apply
|
||||
C= pass it through git-apply
|
||||
p= pass it through git-apply
|
||||
resolvemsg= override error message when patch failure occurs
|
||||
r,resolved to be used after a patch failure
|
||||
skip skip the current patch"
|
||||
|
||||
. git-sh-setup
|
||||
set_reflog_action am
|
||||
require_work_tree
|
||||
@@ -110,49 +125,38 @@ git_apply_opt=
|
||||
while test $# != 0
|
||||
do
|
||||
case "$1" in
|
||||
-d=*|--d=*|--do=*|--dot=*|--dote=*|--dotes=*|--dotest=*)
|
||||
dotest=`expr "z$1" : 'z-[^=]*=\(.*\)'`; shift ;;
|
||||
-d|--d|--do|--dot|--dote|--dotes|--dotest)
|
||||
case "$#" in 1) usage ;; esac; shift
|
||||
dotest="$1"; shift;;
|
||||
|
||||
-i|--i|--in|--int|--inte|--inter|--intera|--interac|--interact|\
|
||||
--interacti|--interactiv|--interactive)
|
||||
interactive=t; shift ;;
|
||||
|
||||
-b|--b|--bi|--bin|--bina|--binar|--binary)
|
||||
binary=t; shift ;;
|
||||
|
||||
-3|--3|--3w|--3wa|--3way)
|
||||
threeway=t; shift ;;
|
||||
-s|--s|--si|--sig|--sign|--signo|--signof|--signoff)
|
||||
sign=t; shift ;;
|
||||
-u|--u|--ut|--utf|--utf8)
|
||||
utf8=t; shift ;; # this is now default
|
||||
--no-u|--no-ut|--no-utf|--no-utf8)
|
||||
utf8=; shift ;;
|
||||
-k|--k|--ke|--kee|--keep)
|
||||
keep=t; shift ;;
|
||||
|
||||
-r|--r|--re|--res|--reso|--resol|--resolv|--resolve|--resolved)
|
||||
resolved=t; shift ;;
|
||||
|
||||
--sk|--ski|--skip)
|
||||
skip=t; shift ;;
|
||||
|
||||
--whitespace=*|-C*|-p*)
|
||||
git_apply_opt="$git_apply_opt $1"; shift ;;
|
||||
|
||||
--resolvemsg=*)
|
||||
resolvemsg=${1#--resolvemsg=}; shift ;;
|
||||
|
||||
-i|--interactive)
|
||||
interactive=t ;;
|
||||
-b|--binary)
|
||||
binary=t ;;
|
||||
-3|--3way)
|
||||
threeway=t ;;
|
||||
-s|--signoff)
|
||||
sign=t ;;
|
||||
-u|--utf8)
|
||||
utf8=t ;; # this is now default
|
||||
--no-utf8)
|
||||
utf8= ;;
|
||||
-k|--keep)
|
||||
keep=t ;;
|
||||
-r|--resolved)
|
||||
resolved=t ;;
|
||||
--skip)
|
||||
skip=t ;;
|
||||
-d|--dotest)
|
||||
shift; dotest=$1;;
|
||||
--resolvemsg)
|
||||
shift; resolvemsg=$1 ;;
|
||||
--whitespace)
|
||||
git_apply_opt="$git_apply_opt $1=$2"; shift ;;
|
||||
-C|-p)
|
||||
git_apply_opt="$git_apply_opt $1$2"; shift ;;
|
||||
--)
|
||||
shift; break ;;
|
||||
-*)
|
||||
usage ;;
|
||||
shift; break ;;
|
||||
*)
|
||||
break ;;
|
||||
usage ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# If the dotest directory exists, but we have finished applying all the
|
||||
|
||||
@@ -22,6 +22,7 @@ git bisect log
|
||||
git bisect run <cmd>...
|
||||
use <cmd>... to automatically bisect.'
|
||||
|
||||
OPTIONS_SPEC=
|
||||
. git-sh-setup
|
||||
require_work_tree
|
||||
|
||||
|
||||
105
git-checkout.sh
105
git-checkout.sh
@@ -1,6 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
USAGE='[-q] [-f] [-b <new_branch>] [-m] [<branch>] [<paths>...]'
|
||||
OPTIONS_KEEPDASHDASH=t
|
||||
OPTIONS_SPEC="\
|
||||
git-branch [options] [<branch>] [<paths>...]
|
||||
--
|
||||
b= create a new branch started at <branch>
|
||||
l create the new branchs reflog
|
||||
track tells if the new branch should track the remote branch
|
||||
f proceed even if the index or working tree is not HEAD
|
||||
m performa three-way merge on local modifications if needed
|
||||
q,quiet be quiet
|
||||
"
|
||||
SUBDIRECTORY_OK=Sometimes
|
||||
. git-sh-setup
|
||||
require_work_tree
|
||||
@@ -20,13 +30,12 @@ quiet=
|
||||
v=-v
|
||||
LF='
|
||||
'
|
||||
while [ "$#" != "0" ]; do
|
||||
arg="$1"
|
||||
shift
|
||||
case "$arg" in
|
||||
"-b")
|
||||
newbranch="$1"
|
||||
|
||||
while test $# != 0; do
|
||||
case "$1" in
|
||||
-b)
|
||||
shift
|
||||
newbranch="$1"
|
||||
[ -z "$newbranch" ] &&
|
||||
die "git checkout: -b needs a branch name"
|
||||
git show-ref --verify --quiet -- "refs/heads/$newbranch" &&
|
||||
@@ -34,64 +43,54 @@ while [ "$#" != "0" ]; do
|
||||
git check-ref-format "heads/$newbranch" ||
|
||||
die "git checkout: we do not like '$newbranch' as a branch name."
|
||||
;;
|
||||
"-l")
|
||||
-l)
|
||||
newbranch_log=-l
|
||||
;;
|
||||
"--track"|"--no-track")
|
||||
track="$arg"
|
||||
--track|--no-track)
|
||||
track="$1"
|
||||
;;
|
||||
"-f")
|
||||
-f)
|
||||
force=1
|
||||
;;
|
||||
-m)
|
||||
merge=1
|
||||
;;
|
||||
"-q")
|
||||
-q|--quiet)
|
||||
quiet=1
|
||||
v=
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
if rev=$(git rev-parse --verify "$arg^0" 2>/dev/null)
|
||||
then
|
||||
if [ -z "$rev" ]; then
|
||||
echo "unknown flag $arg"
|
||||
exit 1
|
||||
fi
|
||||
new_name="$arg"
|
||||
if git show-ref --verify --quiet -- "refs/heads/$arg"
|
||||
then
|
||||
rev=$(git rev-parse --verify "refs/heads/$arg^0")
|
||||
branch="$arg"
|
||||
fi
|
||||
new="$rev"
|
||||
elif rev=$(git rev-parse --verify "$arg^{tree}" 2>/dev/null)
|
||||
then
|
||||
# checking out selected paths from a tree-ish.
|
||||
new="$rev"
|
||||
new_name="$arg^{tree}"
|
||||
branch=
|
||||
else
|
||||
new=
|
||||
new_name=
|
||||
branch=
|
||||
set x "$arg" "$@"
|
||||
shift
|
||||
fi
|
||||
case "$1" in
|
||||
--)
|
||||
shift ;;
|
||||
esac
|
||||
break
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
arg="$1"
|
||||
if rev=$(git rev-parse --verify "$arg^0" 2>/dev/null)
|
||||
then
|
||||
[ -z "$rev" ] && die "unknown flag $arg"
|
||||
new_name="$arg"
|
||||
if git show-ref --verify --quiet -- "refs/heads/$arg"
|
||||
then
|
||||
rev=$(git rev-parse --verify "refs/heads/$arg^0")
|
||||
branch="$arg"
|
||||
fi
|
||||
new="$rev"
|
||||
shift
|
||||
elif rev=$(git rev-parse --verify "$arg^{tree}" 2>/dev/null)
|
||||
then
|
||||
# checking out selected paths from a tree-ish.
|
||||
new="$rev"
|
||||
new_name="$arg^{tree}"
|
||||
shift
|
||||
fi
|
||||
[ "$1" = "--" ] && shift
|
||||
|
||||
case "$newbranch,$track" in
|
||||
,--*)
|
||||
die "git checkout: --track and --no-track require -b"
|
||||
@@ -134,12 +133,12 @@ Did you intend to checkout '$@' which can not be resolved as commit?"
|
||||
fi
|
||||
|
||||
# Make sure the request is about existing paths.
|
||||
git ls-files --error-unmatch -- "$@" >/dev/null || exit
|
||||
git ls-files -- "$@" |
|
||||
git checkout-index -f -u --stdin
|
||||
git ls-files --full-name --error-unmatch -- "$@" >/dev/null || exit
|
||||
git ls-files --full-name -- "$@" |
|
||||
(cd_to_toplevel && git checkout-index -f -u --stdin)
|
||||
|
||||
# Run a post-checkout hook -- the HEAD does not change so the
|
||||
# current HEAD is passed in for both args
|
||||
# Run a post-checkout hook -- the HEAD does not change so the
|
||||
# current HEAD is passed in for both args
|
||||
if test -x "$GIT_DIR"/hooks/post-checkout; then
|
||||
"$GIT_DIR"/hooks/post-checkout $old $old 0
|
||||
fi
|
||||
@@ -294,5 +293,5 @@ fi
|
||||
|
||||
# Run a post-checkout hook
|
||||
if test -x "$GIT_DIR"/hooks/post-checkout; then
|
||||
"$GIT_DIR"/hooks/post-checkout $old $new 1
|
||||
"$GIT_DIR"/hooks/post-checkout $old $new 1
|
||||
fi
|
||||
|
||||
36
git-clean.sh
36
git-clean.sh
@@ -3,16 +3,22 @@
|
||||
# Copyright (c) 2005-2006 Pavel Roskin
|
||||
#
|
||||
|
||||
USAGE="[-d] [-f] [-n] [-q] [-x | -X] [--] <paths>..."
|
||||
LONG_USAGE='Clean untracked files from the working directory
|
||||
-d remove directories as well
|
||||
-f override clean.requireForce and clean anyway
|
||||
-n don'\''t remove anything, just show what would be done
|
||||
-q be quiet, only report errors
|
||||
-x remove ignored files as well
|
||||
-X remove only ignored files
|
||||
OPTIONS_KEEPDASHDASH=
|
||||
OPTIONS_SPEC="\
|
||||
git-clean [options] <paths>...
|
||||
|
||||
Clean untracked files from the working directory
|
||||
|
||||
When optional <paths>... arguments are given, the paths
|
||||
affected are further limited to those that match them.'
|
||||
affected are further limited to those that match them.
|
||||
--
|
||||
d remove directories as well
|
||||
f override clean.requireForce and clean anyway
|
||||
n don't remove anything, just show what would be done
|
||||
q be quiet, only report errors
|
||||
x remove ignored files as well
|
||||
X remove only ignored files"
|
||||
|
||||
SUBDIRECTORY_OK=Yes
|
||||
. git-sh-setup
|
||||
require_work_tree
|
||||
@@ -56,11 +62,9 @@ do
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
break
|
||||
usage # should not happen
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
@@ -77,9 +81,9 @@ case "$disabled" in
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$ignored,$ignoredonly" in
|
||||
1,1) usage;;
|
||||
esac
|
||||
if [ "$ignored,$ignoredonly" = "1,1" ]; then
|
||||
die "-x and -X cannot be set together"
|
||||
fi
|
||||
|
||||
if [ -z "$ignored" ]; then
|
||||
excl="--exclude-per-directory=.gitignore"
|
||||
|
||||
101
git-clone.sh
101
git-clone.sh
@@ -8,6 +8,25 @@
|
||||
# See git-sh-setup why.
|
||||
unset CDPATH
|
||||
|
||||
OPTIONS_SPEC="\
|
||||
git-clone [options] [--] <repo> [<dir>]
|
||||
--
|
||||
n,no-checkout don't create a checkout
|
||||
bare create a bare repository
|
||||
naked create a bare repository
|
||||
l,local to clone from a local repository
|
||||
no-hardlinks don't use local hardlinks, always copy
|
||||
s,shared setup as a shared repository
|
||||
template= path to the template directory
|
||||
q,quiet be quiet
|
||||
reference= reference repository
|
||||
o,origin= use <name> instead of 'origin' to track upstream
|
||||
u,upload-pack= path to git-upload-pack on the remote
|
||||
depth= create a shallow clone of that depth
|
||||
|
||||
use-separate-remote compatibility, do not use
|
||||
no-separate-remote compatibility, do not use"
|
||||
|
||||
die() {
|
||||
echo >&2 "$@"
|
||||
exit 1
|
||||
@@ -51,9 +70,11 @@ case $(uname -s) in
|
||||
esac
|
||||
|
||||
usage() {
|
||||
die "Usage: $0 [--template=<template_directory>] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [--depth <n>] [-n] [--] <repo> [<dir>]"
|
||||
exec "$0" -h
|
||||
}
|
||||
|
||||
eval "$(echo "$OPTIONS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)"
|
||||
|
||||
get_repo_base() {
|
||||
(
|
||||
cd "`/bin/pwd -W`" &&
|
||||
@@ -143,67 +164,57 @@ depth=
|
||||
no_progress=
|
||||
local_explicitly_asked_for=
|
||||
test -t 1 || no_progress=--no-progress
|
||||
while
|
||||
case "$#,$1" in
|
||||
0,*) break ;;
|
||||
*,-n|*,--no|*,--no-|*,--no-c|*,--no-ch|*,--no-che|*,--no-chec|\
|
||||
*,--no-check|*,--no-checko|*,--no-checkou|*,--no-checkout)
|
||||
no_checkout=yes ;;
|
||||
*,--na|*,--nak|*,--nake|*,--naked|\
|
||||
*,-b|*,--b|*,--ba|*,--bar|*,--bare) bare=yes ;;
|
||||
*,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local)
|
||||
local_explicitly_asked_for=yes
|
||||
use_local_hardlink=yes ;;
|
||||
*,--no-h|*,--no-ha|*,--no-har|*,--no-hard|*,--no-hardl|\
|
||||
*,--no-hardli|*,--no-hardlin|*,--no-hardlink|*,--no-hardlinks)
|
||||
use_local_hardlink=no ;;
|
||||
*,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared)
|
||||
local_shared=yes; ;;
|
||||
1,--template) usage ;;
|
||||
*,--template)
|
||||
|
||||
while test $# != 0
|
||||
do
|
||||
case "$1" in
|
||||
-n|--no-checkout)
|
||||
no_checkout=yes ;;
|
||||
--naked|--bare)
|
||||
bare=yes ;;
|
||||
-l|--local)
|
||||
local_explicitly_asked_for=yes
|
||||
use_local_hardlink=yes
|
||||
;;
|
||||
--no-hardlinks)
|
||||
use_local_hardlink=no ;;
|
||||
-s|--shared)
|
||||
local_shared=yes ;;
|
||||
--template)
|
||||
shift; template="--template=$1" ;;
|
||||
*,--template=*)
|
||||
template="$1" ;;
|
||||
*,-q|*,--quiet) quiet=-q ;;
|
||||
*,--use-separate-remote) ;;
|
||||
*,--no-separate-remote)
|
||||
-q|--quiet)
|
||||
quiet=-q ;;
|
||||
--use-separate-remote|--no-separate-remote)
|
||||
die "clones are always made with separate-remote layout" ;;
|
||||
1,--reference) usage ;;
|
||||
*,--reference)
|
||||
--reference)
|
||||
shift; reference="$1" ;;
|
||||
*,--reference=*)
|
||||
reference=`expr "z$1" : 'z--reference=\(.*\)'` ;;
|
||||
*,-o|*,--or|*,--ori|*,--orig|*,--origi|*,--origin)
|
||||
case "$2" in
|
||||
-o,--origin)
|
||||
shift;
|
||||
case "$1" in
|
||||
'')
|
||||
usage ;;
|
||||
*/*)
|
||||
die "'$2' is not suitable for an origin name"
|
||||
die "'$1' is not suitable for an origin name"
|
||||
esac
|
||||
git check-ref-format "heads/$2" ||
|
||||
die "'$2' is not suitable for a branch name"
|
||||
git check-ref-format "heads/$1" ||
|
||||
die "'$1' is not suitable for a branch name"
|
||||
test -z "$origin_override" ||
|
||||
die "Do not give more than one --origin options."
|
||||
origin_override=yes
|
||||
origin="$2"; shift
|
||||
origin="$1"
|
||||
;;
|
||||
1,-u|1,--upload-pack) usage ;;
|
||||
*,-u|*,--upload-pack)
|
||||
-u|--upload-pack)
|
||||
shift
|
||||
upload_pack="--upload-pack=$1" ;;
|
||||
*,--upload-pack=*)
|
||||
upload_pack=--upload-pack=$(expr "z$1" : 'z-[^=]*=\(.*\)') ;;
|
||||
1,--depth) usage;;
|
||||
*,--depth)
|
||||
--depth)
|
||||
shift
|
||||
depth="--depth=$1";;
|
||||
*,--)
|
||||
depth="--depth=$1" ;;
|
||||
--)
|
||||
shift
|
||||
break ;;
|
||||
*,-*) usage ;;
|
||||
*) break ;;
|
||||
*)
|
||||
usage ;;
|
||||
esac
|
||||
do
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [--template <file>] [[-i | -o] <path>...]'
|
||||
SUBDIRECTORY_OK=Yes
|
||||
OPTIONS_SPEC=
|
||||
. git-sh-setup
|
||||
require_work_tree
|
||||
|
||||
|
||||
@@ -4,10 +4,24 @@
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
#ifndef FLEX_ARRAY
|
||||
#if defined(__GNUC__) && (__GNUC__ < 3)
|
||||
#define FLEX_ARRAY 0
|
||||
#else
|
||||
#define FLEX_ARRAY /* empty */
|
||||
/*
|
||||
* See if our compiler is known to support flexible array members.
|
||||
*/
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
# define FLEX_ARRAY /* empty */
|
||||
#elif defined(__GNUC__)
|
||||
# if (__GNUC__ >= 3)
|
||||
# define FLEX_ARRAY /* empty */
|
||||
# else
|
||||
# define FLEX_ARRAY 0 /* older GNU extension */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Otherwise, default to safer but a bit wasteful traditional style
|
||||
*/
|
||||
#ifndef FLEX_ARRAY
|
||||
# define FLEX_ARRAY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -20,6 +34,7 @@
|
||||
#endif
|
||||
|
||||
#define MSB(x, bits) ((x) & TYPEOF(x)(~0ULL << (sizeof(x) * 8 - (bits))))
|
||||
#define HAS_MULTI_BITS(i) ((i) & ((i) - 1)) /* checks if an integer has more than 1 bit set */
|
||||
|
||||
/* Approximation of the length of the decimal representation of this type. */
|
||||
#define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1)
|
||||
|
||||
@@ -92,6 +92,7 @@ USAGE="[--env-filter <command>] [--tree-filter <command>] \
|
||||
[--original <namespace>] [-d <directory>] [-f | --force] \
|
||||
[<rev-list options>...]"
|
||||
|
||||
OPTIONS_SPEC=
|
||||
. git-sh-setup
|
||||
|
||||
git diff-files --quiet &&
|
||||
|
||||
5
git-gui/.gitignore
vendored
5
git-gui/.gitignore
vendored
@@ -1,5 +1,8 @@
|
||||
.DS_Store
|
||||
config.mak
|
||||
Git Gui.app*
|
||||
git-gui.tcl
|
||||
GIT-VERSION-FILE
|
||||
GIT-GUI-VARS
|
||||
git-citool
|
||||
git-gui
|
||||
lib/tclIndex
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
GVF=GIT-VERSION-FILE
|
||||
DEF_VER=0.8.GITGUI
|
||||
DEF_VER=0.9.GITGUI
|
||||
|
||||
LF='
|
||||
'
|
||||
|
||||
194
git-gui/Makefile
194
git-gui/Makefile
@@ -2,18 +2,27 @@ all::
|
||||
|
||||
# Define V=1 to have a more verbose compile.
|
||||
#
|
||||
# Define NO_MSGFMT if you do not have msgfmt from the GNU gettext
|
||||
# package and want to use our rough pure Tcl po->msg translator.
|
||||
# TCL_PATH must be vaild for this to work.
|
||||
#
|
||||
|
||||
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
|
||||
@$(SHELL_PATH) ./GIT-VERSION-GEN
|
||||
-include GIT-VERSION-FILE
|
||||
|
||||
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
||||
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
|
||||
|
||||
SCRIPT_SH = git-gui.sh
|
||||
GITGUI_MAIN := git-gui
|
||||
GITGUI_BUILT_INS = git-citool
|
||||
ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
|
||||
ALL_LIBFILES = $(wildcard lib/*.tcl)
|
||||
PRELOAD_FILES = lib/class.tcl
|
||||
NONTCL_LIBFILES = \
|
||||
lib/git-gui.ico \
|
||||
$(wildcard lib/win32_*.js) \
|
||||
#end NONTCL_LIBFILES
|
||||
|
||||
ifndef SHELL_PATH
|
||||
SHELL_PATH = /bin/sh
|
||||
@@ -31,7 +40,7 @@ ifndef INSTALL
|
||||
INSTALL = install
|
||||
endif
|
||||
|
||||
RM_F ?= rm -f
|
||||
RM_RF ?= rm -rf
|
||||
RMDIR ?= rmdir
|
||||
|
||||
INSTALL_D0 = $(INSTALL) -d -m755 # space is required here
|
||||
@@ -40,6 +49,8 @@ INSTALL_R0 = $(INSTALL) -m644 # space is required here
|
||||
INSTALL_R1 =
|
||||
INSTALL_X0 = $(INSTALL) -m755 # space is required here
|
||||
INSTALL_X1 =
|
||||
INSTALL_A0 = find # space is required here
|
||||
INSTALL_A1 = | cpio -pud
|
||||
INSTALL_L0 = rm -f # space is required here
|
||||
INSTALL_L1 = && ln # space is required here
|
||||
INSTALL_L2 =
|
||||
@@ -47,15 +58,16 @@ INSTALL_L3 =
|
||||
|
||||
REMOVE_D0 = $(RMDIR) # space is required here
|
||||
REMOVE_D1 = || true
|
||||
REMOVE_F0 = $(RM_F) # space is required here
|
||||
REMOVE_F0 = $(RM_RF) # space is required here
|
||||
REMOVE_F1 =
|
||||
CLEAN_DST = true
|
||||
|
||||
ifndef V
|
||||
QUIET = @
|
||||
QUIET_GEN = $(QUIET)echo ' ' GEN $@ &&
|
||||
QUIET_BUILT_IN = $(QUIET)echo ' ' BUILTIN $@ &&
|
||||
QUIET_GEN = $(QUIET)echo ' ' GEN '$@' &&
|
||||
QUIET_INDEX = $(QUIET)echo ' ' INDEX $(dir $@) &&
|
||||
QUIET_MSGFMT0 = $(QUIET)printf ' MSGFMT %12s ' $@ && v=`
|
||||
QUIET_MSGFMT1 = 2>&1` && echo "$$v" | sed -e 's/fuzzy translations/fuzzy/' | sed -e 's/ messages//g'
|
||||
QUIET_2DEVNULL = 2>/dev/null
|
||||
|
||||
INSTALL_D0 = dir=
|
||||
@@ -64,6 +76,8 @@ ifndef V
|
||||
INSTALL_R1 = && echo ' ' INSTALL 644 `basename $$src` && $(INSTALL) -m644 $$src
|
||||
INSTALL_X0 = src=
|
||||
INSTALL_X1 = && echo ' ' INSTALL 755 `basename $$src` && $(INSTALL) -m755 $$src
|
||||
INSTALL_A0 = src=
|
||||
INSTALL_A1 = && echo ' ' INSTALL ' ' `basename "$$src"` && find "$$src" | cpio -pud
|
||||
|
||||
INSTALL_L0 = dst=
|
||||
INSTALL_L1 = && src=
|
||||
@@ -74,51 +88,133 @@ ifndef V
|
||||
REMOVE_D0 = dir=
|
||||
REMOVE_D1 = && echo ' ' REMOVE $$dir && test -d "$$dir" && $(RMDIR) "$$dir" || true
|
||||
REMOVE_F0 = dst=
|
||||
REMOVE_F1 = && echo ' ' REMOVE `basename "$$dst"` && $(RM_F) "$$dst"
|
||||
REMOVE_F1 = && echo ' ' REMOVE `basename "$$dst"` && $(RM_RF) "$$dst"
|
||||
endif
|
||||
|
||||
TCL_PATH ?= tclsh
|
||||
TCLTK_PATH ?= wish
|
||||
TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
|
||||
|
||||
ifeq ($(findstring $(MAKEFLAGS),s),s)
|
||||
QUIET_GEN =
|
||||
QUIET_BUILT_IN =
|
||||
endif
|
||||
|
||||
-include config.mak
|
||||
|
||||
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
|
||||
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
|
||||
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
|
||||
TCL_PATH_SQ = $(subst ','\'',$(TCL_PATH))
|
||||
TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
|
||||
TCLTK_PATH_SED = $(subst ','\'',$(subst \,\\,$(TCLTK_PATH)))
|
||||
|
||||
gg_libdir ?= $(sharedir)/git-gui/lib
|
||||
libdir_SQ = $(subst ','\'',$(gg_libdir))
|
||||
libdir_SED = $(subst ','\'',$(subst \,\\,$(gg_libdir)))
|
||||
exedir = $(dir $(gitexecdir))share/git-gui/lib
|
||||
|
||||
exedir = $(dir $(gitexecdir))share/git-gui/lib
|
||||
exedir_SQ = $(subst ','\'',$(exedir))
|
||||
GITGUI_SCRIPT := $$0
|
||||
GITGUI_RELATIVE :=
|
||||
GITGUI_MACOSXAPP :=
|
||||
|
||||
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
|
||||
ifeq ($(exedir),$(gg_libdir))
|
||||
GITGUI_RELATIVE := 1
|
||||
endif
|
||||
|
||||
ifeq ($(uname_O),Cygwin)
|
||||
GITGUI_SCRIPT := `cygpath --windows --absolute "$(GITGUI_SCRIPT)"`
|
||||
ifeq ($(GITGUI_RELATIVE),)
|
||||
gg_libdir := $(shell cygpath --windows --absolute "$(gg_libdir)")
|
||||
endif
|
||||
endif
|
||||
ifeq ($(uname_S),Darwin)
|
||||
ifeq ($(shell test -d $(TKFRAMEWORK) && echo y),y)
|
||||
GITGUI_MACOSXAPP := YesPlease
|
||||
endif
|
||||
endif
|
||||
ifneq (,$(findstring MINGW,$(uname_S)))
|
||||
NO_MSGFMT=1
|
||||
GITGUI_WINDOWS_WRAPPER := YesPlease
|
||||
endif
|
||||
|
||||
ifdef GITGUI_MACOSXAPP
|
||||
GITGUI_MAIN := git-gui.tcl
|
||||
|
||||
git-gui: GIT-VERSION-FILE GIT-GUI-VARS
|
||||
$(QUIET_GEN)rm -f $@ $@+ && \
|
||||
GITGUI_RELATIVE= && \
|
||||
if test '$(exedir_SQ)' = '$(libdir_SQ)'; then \
|
||||
if test "$(uname_O)" = Cygwin; \
|
||||
then GITGUI_RELATIVE= ; \
|
||||
else GITGUI_RELATIVE=1; \
|
||||
fi; \
|
||||
fi && \
|
||||
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
||||
-e 's|^ exec wish "$$0"| exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' \
|
||||
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
|
||||
-e 's|@@GITGUI_RELATIVE@@|'$$GITGUI_RELATIVE'|' \
|
||||
-e $$GITGUI_RELATIVE's|@@GITGUI_LIBDIR@@|$(libdir_SQ)|' \
|
||||
$@.sh >$@+ && \
|
||||
echo '#!$(SHELL_PATH_SQ)' >$@+ && \
|
||||
echo 'if test "z$$*" = zversion ||' >>$@+ && \
|
||||
echo ' test "z$$*" = z--version' >>$@+ && \
|
||||
echo then >>$@+ && \
|
||||
echo ' 'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \
|
||||
echo else >>$@+ && \
|
||||
echo ' 'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/Wish'\' \
|
||||
'"$$0" "$$@"' >>$@+ && \
|
||||
echo fi >>$@+ && \
|
||||
chmod +x $@+ && \
|
||||
mv $@+ $@
|
||||
|
||||
$(GITGUI_BUILT_INS): git-gui
|
||||
$(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@
|
||||
Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-VARS \
|
||||
macosx/Info.plist \
|
||||
macosx/git-gui.icns \
|
||||
macosx/AppMain.tcl \
|
||||
$(TKFRAMEWORK)/Contents/MacOS/Wish
|
||||
$(QUIET_GEN)rm -rf '$@' '$@'+ && \
|
||||
mkdir -p '$@'+/Contents/MacOS && \
|
||||
mkdir -p '$@'+/Contents/Resources/Scripts && \
|
||||
cp '$(subst ','\'',$(TKFRAMEWORK))/Contents/MacOS/Wish' \
|
||||
'$@'+/Contents/MacOS && \
|
||||
cp macosx/git-gui.icns '$@'+/Contents/Resources && \
|
||||
sed -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
|
||||
macosx/Info.plist \
|
||||
>'$@'+/Contents/Info.plist && \
|
||||
sed -e 's|@@gitexecdir@@|$(gitexecdir_SQ)|' \
|
||||
-e 's|@@GITGUI_LIBDIR@@|$(libdir_SED)|' \
|
||||
macosx/AppMain.tcl \
|
||||
>'$@'+/Contents/Resources/Scripts/AppMain.tcl && \
|
||||
mv '$@'+ '$@'
|
||||
endif
|
||||
|
||||
lib/tclIndex: $(ALL_LIBFILES)
|
||||
ifdef GITGUI_WINDOWS_WRAPPER
|
||||
GITGUI_MAIN := git-gui.tcl
|
||||
|
||||
git-gui: windows/git-gui.sh
|
||||
cp $< $@
|
||||
endif
|
||||
|
||||
$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-VARS
|
||||
$(QUIET_GEN)rm -f $@ $@+ && \
|
||||
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
||||
-e '1,30s|^ argv0=$$0| argv0=$(GITGUI_SCRIPT)|' \
|
||||
-e '1,30s|^ exec wish | exec '\''$(TCLTK_PATH_SED)'\'' |' \
|
||||
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
|
||||
-e 's|@@GITGUI_RELATIVE@@|$(GITGUI_RELATIVE)|' \
|
||||
-e '$(GITGUI_RELATIVE)s|@@GITGUI_LIBDIR@@|$(libdir_SED)|' \
|
||||
git-gui.sh >$@+ && \
|
||||
chmod +x $@+ && \
|
||||
mv $@+ $@
|
||||
|
||||
XGETTEXT ?= xgettext
|
||||
ifdef NO_MSGFMT
|
||||
MSGFMT ?= $(TCL_PATH) po/po2msg.sh
|
||||
else
|
||||
MSGFMT ?= msgfmt
|
||||
endif
|
||||
|
||||
msgsdir = $(gg_libdir)/msgs
|
||||
msgsdir_SQ = $(subst ','\'',$(msgsdir))
|
||||
PO_TEMPLATE = po/git-gui.pot
|
||||
ALL_POFILES = $(wildcard po/*.po)
|
||||
ALL_MSGFILES = $(subst .po,.msg,$(ALL_POFILES))
|
||||
|
||||
$(PO_TEMPLATE): $(SCRIPT_SH) $(ALL_LIBFILES)
|
||||
$(XGETTEXT) -kmc -LTcl -o $@ $(SCRIPT_SH) $(ALL_LIBFILES)
|
||||
update-po:: $(PO_TEMPLATE)
|
||||
$(foreach p, $(ALL_POFILES), echo Updating $p ; msgmerge -U $p $(PO_TEMPLATE) ; )
|
||||
$(ALL_MSGFILES): %.msg : %.po
|
||||
$(QUIET_MSGFMT0)$(MSGFMT) --statistics --tcl $< -l $(basename $(notdir $<)) -d $(dir $@) $(QUIET_MSGFMT1)
|
||||
|
||||
lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS
|
||||
$(QUIET_INDEX)if echo \
|
||||
$(foreach p,$(PRELOAD_FILES),source $p\;) \
|
||||
auto_mkindex lib '*.tcl' \
|
||||
@@ -132,16 +228,13 @@ lib/tclIndex: $(ALL_LIBFILES)
|
||||
echo >>$@ ; \
|
||||
fi
|
||||
|
||||
# These can record GITGUI_VERSION
|
||||
$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE GIT-GUI-VARS
|
||||
lib/tclIndex: GIT-GUI-VARS
|
||||
|
||||
TRACK_VARS = \
|
||||
$(subst ','\'',SHELL_PATH='$(SHELL_PATH_SQ)') \
|
||||
$(subst ','\'',TCL_PATH='$(TCL_PATH_SQ)') \
|
||||
$(subst ','\'',TCLTK_PATH='$(TCLTK_PATH_SQ)') \
|
||||
$(subst ','\'',gitexecdir='$(gitexecdir_SQ)') \
|
||||
$(subst ','\'',gg_libdir='$(libdir_SQ)') \
|
||||
GITGUI_MACOSXAPP=$(GITGUI_MACOSXAPP) \
|
||||
#end TRACK_VARS
|
||||
|
||||
GIT-GUI-VARS: .FORCE-GIT-GUI-VARS
|
||||
@@ -151,24 +244,49 @@ GIT-GUI-VARS: .FORCE-GIT-GUI-VARS
|
||||
echo 1>$@ "$$VARS"; \
|
||||
fi
|
||||
|
||||
all:: $(ALL_PROGRAMS) lib/tclIndex
|
||||
ifdef GITGUI_MACOSXAPP
|
||||
all:: git-gui Git\ Gui.app
|
||||
endif
|
||||
ifdef GITGUI_WINDOWS_WRAPPER
|
||||
all:: git-gui
|
||||
endif
|
||||
all:: $(GITGUI_MAIN) lib/tclIndex $(ALL_MSGFILES)
|
||||
|
||||
install: all
|
||||
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
|
||||
$(QUIET)$(INSTALL_X0)git-gui $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
|
||||
$(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(INSTALL_L0)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L1)'$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' $(INSTALL_L2)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L3) &&) true
|
||||
ifdef GITGUI_WINDOWS_WRAPPER
|
||||
$(QUIET)$(INSTALL_R0)git-gui.tcl $(INSTALL_R1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
|
||||
endif
|
||||
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(libdir_SQ)' $(INSTALL_D1)
|
||||
$(QUIET)$(INSTALL_R0)lib/tclIndex $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)'
|
||||
$(QUIET)$(foreach p,$(ALL_LIBFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)' &&) true
|
||||
ifdef GITGUI_MACOSXAPP
|
||||
$(QUIET)$(INSTALL_A0)'Git Gui.app' $(INSTALL_A1) '$(DESTDIR_SQ)$(libdir_SQ)'
|
||||
$(QUIET)$(INSTALL_X0)git-gui.tcl $(INSTALL_X1) '$(DESTDIR_SQ)$(libdir_SQ)'
|
||||
endif
|
||||
$(QUIET)$(foreach p,$(ALL_LIBFILES) $(NONTCL_LIBFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)' &&) true
|
||||
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(msgsdir_SQ)' $(INSTALL_D1)
|
||||
$(QUIET)$(foreach p,$(ALL_MSGFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true
|
||||
|
||||
uninstall:
|
||||
$(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
|
||||
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui $(REMOVE_F1)
|
||||
$(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/$p $(REMOVE_F1) &&) true
|
||||
ifdef GITGUI_WINDOWS_WRAPPER
|
||||
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui.tcl $(REMOVE_F1)
|
||||
endif
|
||||
$(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(libdir_SQ)'
|
||||
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/tclIndex $(REMOVE_F1)
|
||||
$(QUIET)$(foreach p,$(ALL_LIBFILES), $(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/$(notdir $p) $(REMOVE_F1) &&) true
|
||||
ifdef GITGUI_MACOSXAPP
|
||||
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)/Git Gui.app' $(REMOVE_F1)
|
||||
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/git-gui.tcl $(REMOVE_F1)
|
||||
endif
|
||||
$(QUIET)$(foreach p,$(ALL_LIBFILES) $(NONTCL_LIBFILES), $(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/$(notdir $p) $(REMOVE_F1) &&) true
|
||||
$(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(msgsdir_SQ)'
|
||||
$(QUIET)$(foreach p,$(ALL_MSGFILES), $(REMOVE_F0)'$(DESTDIR_SQ)$(msgsdir_SQ)'/$(notdir $p) $(REMOVE_F1) &&) true
|
||||
$(QUIET)$(REMOVE_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(REMOVE_D1)
|
||||
$(QUIET)$(REMOVE_D0)'$(DESTDIR_SQ)$(msgsdir_SQ)' $(REMOVE_D1)
|
||||
$(QUIET)$(REMOVE_D0)'$(DESTDIR_SQ)$(libdir_SQ)' $(REMOVE_D1)
|
||||
$(QUIET)$(REMOVE_D0)`dirname '$(DESTDIR_SQ)$(libdir_SQ)'` $(REMOVE_D1)
|
||||
|
||||
@@ -177,8 +295,14 @@ dist-version:
|
||||
@echo $(GITGUI_VERSION) > $(TARDIR)/version
|
||||
|
||||
clean::
|
||||
rm -f $(ALL_PROGRAMS) lib/tclIndex
|
||||
rm -f GIT-VERSION-FILE GIT-GUI-VARS
|
||||
$(RM_RF) $(GITGUI_MAIN) lib/tclIndex po/*.msg
|
||||
$(RM_RF) GIT-VERSION-FILE GIT-GUI-VARS
|
||||
ifdef GITGUI_MACOSXAPP
|
||||
$(RM_RF) 'Git Gui.app'* git-gui
|
||||
endif
|
||||
ifdef GITGUI_WINDOWS_WRAPPER
|
||||
$(RM_RF) git-gui
|
||||
endif
|
||||
|
||||
.PHONY: all install uninstall dist-version clean
|
||||
.PHONY: .FORCE-GIT-VERSION-FILE
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
81
git-gui/lib/about.tcl
Normal file
81
git-gui/lib/about.tcl
Normal file
@@ -0,0 +1,81 @@
|
||||
# git-gui about git-gui dialog
|
||||
# Copyright (C) 2006, 2007 Shawn Pearce
|
||||
|
||||
proc do_about {} {
|
||||
global appvers copyright oguilib
|
||||
global tcl_patchLevel tk_patchLevel
|
||||
|
||||
set w .about_dialog
|
||||
toplevel $w
|
||||
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
|
||||
|
||||
pack [git_logo $w.git_logo] -side left -fill y -padx 10 -pady 10
|
||||
label $w.header -text [mc "About %s" [appname]] \
|
||||
-font font_uibold
|
||||
pack $w.header -side top -fill x
|
||||
|
||||
frame $w.buttons
|
||||
button $w.buttons.close -text {Close} \
|
||||
-default active \
|
||||
-command [list destroy $w]
|
||||
pack $w.buttons.close -side right
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
label $w.desc \
|
||||
-text "[mc "git-gui - a graphical user interface for Git."]\n$copyright" \
|
||||
-padx 5 -pady 5 \
|
||||
-justify left \
|
||||
-anchor w \
|
||||
-borderwidth 1 \
|
||||
-relief solid
|
||||
pack $w.desc -side top -fill x -padx 5 -pady 5
|
||||
|
||||
set v {}
|
||||
append v "git-gui version $appvers\n"
|
||||
append v "[git version]\n"
|
||||
append v "\n"
|
||||
if {$tcl_patchLevel eq $tk_patchLevel} {
|
||||
append v "Tcl/Tk version $tcl_patchLevel"
|
||||
} else {
|
||||
append v "Tcl version $tcl_patchLevel"
|
||||
append v ", Tk version $tk_patchLevel"
|
||||
}
|
||||
|
||||
set d {}
|
||||
append d "git wrapper: $::_git\n"
|
||||
append d "git exec dir: [gitexec]\n"
|
||||
append d "git-gui lib: $oguilib"
|
||||
|
||||
label $w.vers \
|
||||
-text $v \
|
||||
-padx 5 -pady 5 \
|
||||
-justify left \
|
||||
-anchor w \
|
||||
-borderwidth 1 \
|
||||
-relief solid
|
||||
pack $w.vers -side top -fill x -padx 5 -pady 5
|
||||
|
||||
label $w.dirs \
|
||||
-text $d \
|
||||
-padx 5 -pady 5 \
|
||||
-justify left \
|
||||
-anchor w \
|
||||
-borderwidth 1 \
|
||||
-relief solid
|
||||
pack $w.dirs -side top -fill x -padx 5 -pady 5
|
||||
|
||||
menu $w.ctxm -tearoff 0
|
||||
$w.ctxm add command \
|
||||
-label {Copy} \
|
||||
-command "
|
||||
clipboard clear
|
||||
clipboard append -format STRING -type STRING -- \[$w.vers cget -text\]
|
||||
"
|
||||
|
||||
bind $w <Visibility> "grab $w; focus $w.buttons.close"
|
||||
bind $w <Key-Escape> "destroy $w"
|
||||
bind $w <Key-Return> "destroy $w"
|
||||
bind_button3 $w.vers "tk_popup $w.ctxm %X %Y; grab $w; focus $w"
|
||||
wm title $w "About [appname]"
|
||||
tkwait window $w
|
||||
}
|
||||
@@ -74,11 +74,11 @@ constructor new {i_commit i_path} {
|
||||
set path $i_path
|
||||
|
||||
make_toplevel top w
|
||||
wm title $top "[appname] ([reponame]): File Viewer"
|
||||
wm title $top [append "[appname] ([reponame]): " [mc "File Viewer"]]
|
||||
|
||||
frame $w.header -background gold
|
||||
label $w.header.commit_l \
|
||||
-text {Commit:} \
|
||||
-text [mc "Commit:"] \
|
||||
-background gold \
|
||||
-anchor w \
|
||||
-justify left
|
||||
@@ -101,7 +101,7 @@ constructor new {i_commit i_path} {
|
||||
-anchor w \
|
||||
-justify left
|
||||
label $w.header.path_l \
|
||||
-text {File:} \
|
||||
-text [mc "File:"] \
|
||||
-background gold \
|
||||
-anchor w \
|
||||
-justify left
|
||||
@@ -246,7 +246,7 @@ constructor new {i_commit i_path} {
|
||||
|
||||
menu $w.ctxm -tearoff 0
|
||||
$w.ctxm add command \
|
||||
-label "Copy Commit" \
|
||||
-label [mc "Copy Commit"] \
|
||||
-command [cb _copycommit]
|
||||
|
||||
foreach i $w_columns {
|
||||
@@ -366,7 +366,7 @@ method _load {jump} {
|
||||
set amov_data [list [list]]
|
||||
set asim_data [list [list]]
|
||||
|
||||
$status show "Reading $commit:[escape_path $path]..."
|
||||
$status show [mc "Reading %s..." "$commit:[escape_path $path]"]
|
||||
$w_path conf -text [escape_path $path]
|
||||
if {$commit eq {}} {
|
||||
set fd [open $path r]
|
||||
@@ -470,7 +470,7 @@ method _read_file {fd jump} {
|
||||
|
||||
_exec_blame $this $w_asim @asim_data \
|
||||
[list] \
|
||||
{ copy/move tracking}
|
||||
[mc "Loading copy/move tracking annotations..."]
|
||||
}
|
||||
} ifdeleted { catch {close $fd} }
|
||||
|
||||
@@ -489,8 +489,8 @@ method _exec_blame {cur_w cur_d options cur_s} {
|
||||
set blame_lines 0
|
||||
|
||||
$status start \
|
||||
"Loading$cur_s annotations..." \
|
||||
{lines annotated}
|
||||
$cur_s \
|
||||
[mc "lines annotated"]
|
||||
}
|
||||
|
||||
method _read_blame {fd cur_w cur_d} {
|
||||
@@ -671,10 +671,10 @@ method _read_blame {fd cur_w cur_d} {
|
||||
if {$cur_w eq $w_asim} {
|
||||
_exec_blame $this $w_amov @amov_data \
|
||||
$original_options \
|
||||
{ original location}
|
||||
[mc "Loading original location annotations..."]
|
||||
} else {
|
||||
set current_fd {}
|
||||
$status stop {Annotation complete.}
|
||||
$status stop [mc "Annotation complete."]
|
||||
}
|
||||
} else {
|
||||
$status update $blame_lines $total_lines
|
||||
@@ -728,7 +728,7 @@ method _showcommit {cur_w lno} {
|
||||
|
||||
if {$dat eq {}} {
|
||||
set cmit {}
|
||||
$w_cviewer insert end "Loading annotation..." still_loading
|
||||
$w_cviewer insert end [mc "Loading annotation..."] still_loading
|
||||
} else {
|
||||
set cmit [lindex $dat 0]
|
||||
set file [lindex $dat 1]
|
||||
@@ -743,20 +743,14 @@ method _showcommit {cur_w lno} {
|
||||
set author_time {}
|
||||
catch {set author_name $header($cmit,author)}
|
||||
catch {set author_email $header($cmit,author-mail)}
|
||||
catch {set author_time [clock format \
|
||||
$header($cmit,author-time) \
|
||||
-format {%Y-%m-%d %H:%M:%S}
|
||||
]}
|
||||
catch {set author_time [format_date $header($cmit,author-time)]}
|
||||
|
||||
set committer_name {}
|
||||
set committer_email {}
|
||||
set committer_time {}
|
||||
catch {set committer_name $header($cmit,committer)}
|
||||
catch {set committer_email $header($cmit,committer-mail)}
|
||||
catch {set committer_time [clock format \
|
||||
$header($cmit,committer-time) \
|
||||
-format {%Y-%m-%d %H:%M:%S}
|
||||
]}
|
||||
catch {set committer_time [format_date $header($cmit,committer-time)]}
|
||||
|
||||
if {[catch {set msg $header($cmit,message)}]} {
|
||||
set msg {}
|
||||
@@ -790,16 +784,16 @@ method _showcommit {cur_w lno} {
|
||||
}
|
||||
|
||||
$w_cviewer insert end "commit $cmit\n" header_key
|
||||
$w_cviewer insert end "Author:\t" header_key
|
||||
$w_cviewer insert end [strcat [mc "Author:"] "\t"] header_key
|
||||
$w_cviewer insert end "$author_name $author_email" header_val
|
||||
$w_cviewer insert end " $author_time\n" header_val
|
||||
|
||||
$w_cviewer insert end "Committer:\t" header_key
|
||||
$w_cviewer insert end [strcat [mc "Committer:"] "\t"] header_key
|
||||
$w_cviewer insert end "$committer_name $committer_email" header_val
|
||||
$w_cviewer insert end " $committer_time\n" header_val
|
||||
|
||||
if {$file ne $path} {
|
||||
$w_cviewer insert end "Original File:\t" header_key
|
||||
$w_cviewer insert end [strcat [mc "Original File:"] "\t"] header_key
|
||||
$w_cviewer insert end "[escape_path $file]\n" header_val
|
||||
}
|
||||
|
||||
@@ -892,10 +886,7 @@ method _open_tooltip {cur_w} {
|
||||
set author_time {}
|
||||
catch {set author_name $header($cmit,author)}
|
||||
catch {set summary $header($cmit,summary)}
|
||||
catch {set author_time [clock format \
|
||||
$header($cmit,author-time) \
|
||||
-format {%Y-%m-%d %H:%M:%S}
|
||||
]}
|
||||
catch {set author_time [format_date $header($cmit,author-time)]}
|
||||
|
||||
$tooltip_t insert end "commit $cmit\n"
|
||||
$tooltip_t insert end "$author_name $author_time\n"
|
||||
@@ -914,23 +905,20 @@ method _open_tooltip {cur_w} {
|
||||
set author_time {}
|
||||
catch {set author_name $header($cmit,author)}
|
||||
catch {set summary $header($cmit,summary)}
|
||||
catch {set author_time [clock format \
|
||||
$header($cmit,author-time) \
|
||||
-format {%Y-%m-%d %H:%M:%S}
|
||||
]}
|
||||
catch {set author_time [format_date $header($cmit,author-time)]}
|
||||
|
||||
$tooltip_t insert end "Originally By:\n" section_header
|
||||
$tooltip_t insert end [strcat [mc "Originally By:"] "\n"] section_header
|
||||
$tooltip_t insert end "commit $cmit\n"
|
||||
$tooltip_t insert end "$author_name $author_time\n"
|
||||
$tooltip_t insert end "$summary\n"
|
||||
|
||||
if {$file ne $path} {
|
||||
$tooltip_t insert end "In File: " section_header
|
||||
$tooltip_t insert end [strcat [mc "In File:"] " "] section_header
|
||||
$tooltip_t insert end "$file\n"
|
||||
}
|
||||
|
||||
$tooltip_t insert end "\n"
|
||||
$tooltip_t insert end "Copied Or Moved Here By:\n" section_header
|
||||
$tooltip_t insert end [strcat [mc "Copied Or Moved Here By:"] "\n"] section_header
|
||||
$tooltip_t insert end $save
|
||||
}
|
||||
|
||||
|
||||
@@ -11,37 +11,37 @@ field opt_detach 0; # force a detached head case?
|
||||
|
||||
constructor dialog {} {
|
||||
make_toplevel top w
|
||||
wm title $top "[appname] ([reponame]): Checkout Branch"
|
||||
wm title $top [append "[appname] ([reponame]): " [mc "Checkout Branch"]]
|
||||
if {$top ne {.}} {
|
||||
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
|
||||
}
|
||||
|
||||
label $w.header -text {Checkout Branch} -font font_uibold
|
||||
label $w.header -text [mc "Checkout Branch"] -font font_uibold
|
||||
pack $w.header -side top -fill x
|
||||
|
||||
frame $w.buttons
|
||||
button $w.buttons.create -text Checkout \
|
||||
button $w.buttons.create -text [mc Checkout] \
|
||||
-default active \
|
||||
-command [cb _checkout]
|
||||
pack $w.buttons.create -side right
|
||||
button $w.buttons.cancel -text {Cancel} \
|
||||
button $w.buttons.cancel -text [mc Cancel] \
|
||||
-command [list destroy $w]
|
||||
pack $w.buttons.cancel -side right -padx 5
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
set w_rev [::choose_rev::new $w.rev {Revision}]
|
||||
set w_rev [::choose_rev::new $w.rev [mc Revision]]
|
||||
$w_rev bind_listbox <Double-Button-1> [cb _checkout]
|
||||
pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5
|
||||
|
||||
labelframe $w.options -text {Options}
|
||||
labelframe $w.options -text [mc Options]
|
||||
|
||||
checkbutton $w.options.fetch \
|
||||
-text {Fetch Tracking Branch} \
|
||||
-text [mc "Fetch Tracking Branch"] \
|
||||
-variable @opt_fetch
|
||||
pack $w.options.fetch -anchor nw
|
||||
|
||||
checkbutton $w.options.detach \
|
||||
-text {Detach From Local Branch} \
|
||||
-text [mc "Detach From Local Branch"] \
|
||||
-variable @opt_detach
|
||||
pack $w.options.detach -anchor nw
|
||||
|
||||
|
||||
@@ -19,28 +19,28 @@ constructor dialog {} {
|
||||
global repo_config
|
||||
|
||||
make_toplevel top w
|
||||
wm title $top "[appname] ([reponame]): Create Branch"
|
||||
wm title $top [append "[appname] ([reponame]): " [mc "Create Branch"]]
|
||||
if {$top ne {.}} {
|
||||
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
|
||||
}
|
||||
|
||||
label $w.header -text {Create New Branch} -font font_uibold
|
||||
label $w.header -text [mc "Create New Branch"] -font font_uibold
|
||||
pack $w.header -side top -fill x
|
||||
|
||||
frame $w.buttons
|
||||
button $w.buttons.create -text Create \
|
||||
button $w.buttons.create -text [mc Create] \
|
||||
-default active \
|
||||
-command [cb _create]
|
||||
pack $w.buttons.create -side right
|
||||
button $w.buttons.cancel -text {Cancel} \
|
||||
button $w.buttons.cancel -text [mc Cancel] \
|
||||
-command [list destroy $w]
|
||||
pack $w.buttons.cancel -side right -padx 5
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
labelframe $w.desc -text {Branch Name}
|
||||
labelframe $w.desc -text [mc "Branch Name"]
|
||||
radiobutton $w.desc.name_r \
|
||||
-anchor w \
|
||||
-text {Name:} \
|
||||
-text [mc "Name:"] \
|
||||
-value user \
|
||||
-variable @name_type
|
||||
set w_name $w.desc.name_t
|
||||
@@ -55,7 +55,7 @@ constructor dialog {} {
|
||||
|
||||
radiobutton $w.desc.match_r \
|
||||
-anchor w \
|
||||
-text {Match Tracking Branch Name} \
|
||||
-text [mc "Match Tracking Branch Name"] \
|
||||
-value match \
|
||||
-variable @name_type
|
||||
grid $w.desc.match_r -sticky we -padx {0 5} -columnspan 2
|
||||
@@ -63,38 +63,38 @@ constructor dialog {} {
|
||||
grid columnconfigure $w.desc 1 -weight 1
|
||||
pack $w.desc -anchor nw -fill x -pady 5 -padx 5
|
||||
|
||||
set w_rev [::choose_rev::new $w.rev {Starting Revision}]
|
||||
set w_rev [::choose_rev::new $w.rev [mc "Starting Revision"]]
|
||||
pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5
|
||||
|
||||
labelframe $w.options -text {Options}
|
||||
labelframe $w.options -text [mc Options]
|
||||
|
||||
frame $w.options.merge
|
||||
label $w.options.merge.l -text {Update Existing Branch:}
|
||||
label $w.options.merge.l -text [mc "Update Existing Branch:"]
|
||||
pack $w.options.merge.l -side left
|
||||
radiobutton $w.options.merge.no \
|
||||
-text No \
|
||||
-text [mc No] \
|
||||
-value none \
|
||||
-variable @opt_merge
|
||||
pack $w.options.merge.no -side left
|
||||
radiobutton $w.options.merge.ff \
|
||||
-text {Fast Forward Only} \
|
||||
-text [mc "Fast Forward Only"] \
|
||||
-value ff \
|
||||
-variable @opt_merge
|
||||
pack $w.options.merge.ff -side left
|
||||
radiobutton $w.options.merge.reset \
|
||||
-text {Reset} \
|
||||
-text [mc Reset] \
|
||||
-value reset \
|
||||
-variable @opt_merge
|
||||
pack $w.options.merge.reset -side left
|
||||
pack $w.options.merge -anchor nw
|
||||
|
||||
checkbutton $w.options.fetch \
|
||||
-text {Fetch Tracking Branch} \
|
||||
-text [mc "Fetch Tracking Branch"] \
|
||||
-variable @opt_fetch
|
||||
pack $w.options.fetch -anchor nw
|
||||
|
||||
checkbutton $w.options.checkout \
|
||||
-text {Checkout After Creation} \
|
||||
-text [mc "Checkout After Creation"] \
|
||||
-variable @opt_checkout
|
||||
pack $w.options.checkout -anchor nw
|
||||
pack $w.options -anchor nw -fill x -pady 5 -padx 5
|
||||
@@ -128,7 +128,7 @@ method _create {} {
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message "Please select a tracking branch."
|
||||
-message [mc "Please select a tracking branch."]
|
||||
return
|
||||
}
|
||||
if {![regsub ^refs/heads/ [lindex $spec 2] {} newbranch]} {
|
||||
@@ -137,7 +137,7 @@ method _create {} {
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message "Tracking branch [$w get] is not a branch in the remote repository."
|
||||
-message [mc "Tracking branch %s is not a branch in the remote repository." [$w get]]
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ method _create {} {
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message "Please supply a branch name."
|
||||
-message [mc "Please supply a branch name."]
|
||||
focus $w_name
|
||||
return
|
||||
}
|
||||
@@ -161,7 +161,7 @@ method _create {} {
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message "'$newbranch' is not an acceptable branch name."
|
||||
-message [mc "'%s' is not an acceptable branch name." $newbranch]
|
||||
focus $w_name
|
||||
return
|
||||
}
|
||||
|
||||
@@ -12,29 +12,29 @@ constructor dialog {} {
|
||||
global current_branch
|
||||
|
||||
make_toplevel top w
|
||||
wm title $top "[appname] ([reponame]): Delete Branch"
|
||||
wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch"]]
|
||||
if {$top ne {.}} {
|
||||
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
|
||||
}
|
||||
|
||||
label $w.header -text {Delete Local Branch} -font font_uibold
|
||||
label $w.header -text [mc "Delete Local Branch"] -font font_uibold
|
||||
pack $w.header -side top -fill x
|
||||
|
||||
frame $w.buttons
|
||||
set w_delete $w.buttons.delete
|
||||
button $w_delete \
|
||||
-text Delete \
|
||||
-text [mc Delete] \
|
||||
-default active \
|
||||
-state disabled \
|
||||
-command [cb _delete]
|
||||
pack $w_delete -side right
|
||||
button $w.buttons.cancel \
|
||||
-text {Cancel} \
|
||||
-text [mc Cancel] \
|
||||
-command [list destroy $w]
|
||||
pack $w.buttons.cancel -side right -padx 5
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
labelframe $w.list -text {Local Branches}
|
||||
labelframe $w.list -text [mc "Local Branches"]
|
||||
set w_heads $w.list.l
|
||||
listbox $w_heads \
|
||||
-height 10 \
|
||||
@@ -49,9 +49,9 @@ constructor dialog {} {
|
||||
|
||||
set w_check [choose_rev::new \
|
||||
$w.check \
|
||||
{Delete Only If Merged Into} \
|
||||
[mc "Delete Only If Merged Into"] \
|
||||
]
|
||||
$w_check none {Always (Do not perform merge test.)}
|
||||
$w_check none [mc "Always (Do not perform merge test.)"]
|
||||
pack $w.check -anchor nw -fill x -pady 5 -padx 5
|
||||
|
||||
foreach h [load_all_heads] {
|
||||
@@ -100,7 +100,7 @@ method _delete {} {
|
||||
lappend to_delete [list $b $o]
|
||||
}
|
||||
if {$not_merged ne {}} {
|
||||
set msg "The following branches are not completely merged into [$w_check get]:
|
||||
set msg "[mc "The following branches are not completely merged into %s:" [$w_check get]]
|
||||
|
||||
- [join $not_merged "\n - "]"
|
||||
tk_messageBox \
|
||||
@@ -112,9 +112,7 @@ method _delete {} {
|
||||
}
|
||||
if {$to_delete eq {}} return
|
||||
if {$check_cmt eq {}} {
|
||||
set msg {Recovering deleted branches is difficult.
|
||||
|
||||
Delete the selected branches?}
|
||||
set msg [mc "Recovering deleted branches is difficult. \n\n Delete the selected branches?"]
|
||||
if {[tk_messageBox \
|
||||
-icon warning \
|
||||
-type yesno \
|
||||
@@ -140,7 +138,7 @@ Delete the selected branches?}
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message "Failed to delete branches:\n$failed"
|
||||
-message [mc "Failed to delete branches:\n%s" $failed]
|
||||
}
|
||||
|
||||
destroy $w
|
||||
|
||||
@@ -11,7 +11,7 @@ constructor dialog {} {
|
||||
global current_branch
|
||||
|
||||
make_toplevel top w
|
||||
wm title $top "[appname] ([reponame]): Rename Branch"
|
||||
wm title $top [append "[appname] ([reponame]): " [mc "Rename Branch"]]
|
||||
if {$top ne {.}} {
|
||||
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
|
||||
}
|
||||
@@ -19,24 +19,24 @@ constructor dialog {} {
|
||||
set oldname $current_branch
|
||||
set newname [get_config gui.newbranchtemplate]
|
||||
|
||||
label $w.header -text {Rename Branch} -font font_uibold
|
||||
label $w.header -text [mc "Rename Branch"] -font font_uibold
|
||||
pack $w.header -side top -fill x
|
||||
|
||||
frame $w.buttons
|
||||
button $w.buttons.rename -text Rename \
|
||||
button $w.buttons.rename -text [mc Rename] \
|
||||
-default active \
|
||||
-command [cb _rename]
|
||||
pack $w.buttons.rename -side right
|
||||
button $w.buttons.cancel -text {Cancel} \
|
||||
button $w.buttons.cancel -text [mc Cancel] \
|
||||
-command [list destroy $w]
|
||||
pack $w.buttons.cancel -side right -padx 5
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
frame $w.rename
|
||||
label $w.rename.oldname_l -text {Branch:}
|
||||
label $w.rename.oldname_l -text [mc "Branch:"]
|
||||
eval tk_optionMenu $w.rename.oldname_m @oldname [load_all_heads]
|
||||
|
||||
label $w.rename.newname_l -text {New Name:}
|
||||
label $w.rename.newname_l -text [mc "New Name:"]
|
||||
entry $w.rename.newname_t \
|
||||
-borderwidth 1 \
|
||||
-relief sunken \
|
||||
@@ -72,7 +72,7 @@ method _rename {} {
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message "Please select a branch to rename."
|
||||
-message [mc "Please select a branch to rename."]
|
||||
focus $w.rename.oldname_m
|
||||
return
|
||||
}
|
||||
@@ -83,7 +83,7 @@ method _rename {} {
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message "Please supply a branch name."
|
||||
-message [mc "Please supply a branch name."]
|
||||
focus $w.rename.newname_t
|
||||
return
|
||||
}
|
||||
@@ -93,7 +93,7 @@ method _rename {} {
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message "Branch '$newname' already exists."
|
||||
-message [mc "Branch '%s' already exists." $newname]
|
||||
focus $w.rename.newname_t
|
||||
return
|
||||
}
|
||||
@@ -103,7 +103,7 @@ method _rename {} {
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message "We do not like '$newname' as a branch name."
|
||||
-message [mc "'%s' is not an acceptable branch name." $newname]
|
||||
focus $w.rename.newname_t
|
||||
return
|
||||
}
|
||||
@@ -114,7 +114,7 @@ method _rename {} {
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message "Failed to rename '$oldname'.\n\n$err"
|
||||
-message [strcat [mc "Failed to rename '%s'." $oldname] "\n\n$err"]
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ field w
|
||||
field browser_commit
|
||||
field browser_path
|
||||
field browser_files {}
|
||||
field browser_status {Starting...}
|
||||
field browser_status [mc "Starting..."]
|
||||
field browser_stack {}
|
||||
field browser_busy 1
|
||||
|
||||
@@ -23,7 +23,7 @@ field ls_buf {}; # Buffered record output from ls-tree
|
||||
constructor new {commit {path {}}} {
|
||||
global cursor_ptr M1B
|
||||
make_toplevel top w
|
||||
wm title $top "[appname] ([reponame]): File Browser"
|
||||
wm title $top [append "[appname] ([reponame]): " [mc "File Browser"]]
|
||||
|
||||
set browser_commit $commit
|
||||
set browser_path $browser_commit:$path
|
||||
@@ -122,7 +122,7 @@ method _parent {} {
|
||||
} else {
|
||||
regsub {/[^/]+$} $browser_path {} browser_path
|
||||
}
|
||||
set browser_status "Loading $browser_path..."
|
||||
set browser_status [mc "Loading %s..." $browser_path]
|
||||
_ls $this [lindex $parent 0] [lindex $parent 1]
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ method _enter {} {
|
||||
tree {
|
||||
set name [lindex $info 2]
|
||||
set escn [escape_path $name]
|
||||
set browser_status "Loading $escn..."
|
||||
set browser_status [mc "Loading %s..." $escn]
|
||||
append browser_path $escn
|
||||
_ls $this [lindex $info 1] $name
|
||||
}
|
||||
@@ -183,7 +183,7 @@ method _ls {tree_id {name {}}} {
|
||||
-align center -padx 5 -pady 1 \
|
||||
-name icon0 \
|
||||
-image ::browser::img_parent
|
||||
$w insert end {[Up To Parent]}
|
||||
$w insert end [mc "\[Up To Parent\]"]
|
||||
lappend browser_files parent
|
||||
}
|
||||
lappend browser_stack [list $tree_id $name]
|
||||
@@ -242,7 +242,7 @@ method _read {fd} {
|
||||
|
||||
if {[eof $fd]} {
|
||||
close $fd
|
||||
set browser_status Ready.
|
||||
set browser_status [mc "Ready."]
|
||||
set browser_busy 0
|
||||
set ls_buf {}
|
||||
if {$n > 0} {
|
||||
@@ -263,27 +263,27 @@ field w_rev ; # mega-widget to pick the initial revision
|
||||
|
||||
constructor dialog {} {
|
||||
make_toplevel top w
|
||||
wm title $top "[appname] ([reponame]): Browse Branch Files"
|
||||
wm title $top [append "[appname] ([reponame]): " [mc "Browse Branch Files"]]
|
||||
if {$top ne {.}} {
|
||||
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
|
||||
}
|
||||
|
||||
label $w.header \
|
||||
-text {Browse Branch Files} \
|
||||
-text [mc "Browse Branch Files"] \
|
||||
-font font_uibold
|
||||
pack $w.header -side top -fill x
|
||||
|
||||
frame $w.buttons
|
||||
button $w.buttons.browse -text Browse \
|
||||
button $w.buttons.browse -text [mc Browse] \
|
||||
-default active \
|
||||
-command [cb _open]
|
||||
pack $w.buttons.browse -side right
|
||||
button $w.buttons.cancel -text {Cancel} \
|
||||
button $w.buttons.cancel -text [mc Cancel] \
|
||||
-command [list destroy $w]
|
||||
pack $w.buttons.cancel -side right -padx 5
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
set w_rev [::choose_rev::new $w.rev {Revision}]
|
||||
set w_rev [::choose_rev::new $w.rev [mc Revision]]
|
||||
$w_rev bind_listbox <Double-Button-1> [cb _open]
|
||||
pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ method run {} {
|
||||
_toplevel $this {Refreshing Tracking Branch}
|
||||
set w_cons [::console::embed \
|
||||
$w.console \
|
||||
"Fetching $r_name from $remote"]
|
||||
[mc "Fetching %s from %s" $r_name $remote]]
|
||||
pack $w.console -fill both -expand 1
|
||||
$w_cons exec $cmd [cb _finish_fetch]
|
||||
|
||||
@@ -124,7 +124,7 @@ method _finish_fetch {ok} {
|
||||
}
|
||||
if {[catch {set new_hash [git rev-parse --verify "$l_trck^0"]} err]} {
|
||||
set ok 0
|
||||
$w_cons insert "fatal: Cannot resolve $l_trck"
|
||||
$w_cons insert [mc "fatal: Cannot resolve %s" $l_trck]
|
||||
$w_cons insert $err
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ method _finish_fetch {ok} {
|
||||
destroy $w
|
||||
set w {}
|
||||
} else {
|
||||
button $w.close -text Close -command [list destroy $w]
|
||||
button $w.close -text [mc Close] -command [list destroy $w]
|
||||
pack $w.close -side bottom -anchor e -padx 10 -pady 10
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ method _update_ref {} {
|
||||
# Assume it does not exist, and that is what the error was.
|
||||
#
|
||||
if {!$create} {
|
||||
_error $this "Branch '$newbranch' does not exist."
|
||||
_error $this [mc "Branch '%s' does not exist." $newbranch]
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ method _update_ref {} {
|
||||
# We were told to create it, but not do a merge.
|
||||
# Bad. Name shouldn't have existed.
|
||||
#
|
||||
_error $this "Branch '$newbranch' already exists."
|
||||
_error $this [mc "Branch '%s' already exists." $newbranch]
|
||||
return 0
|
||||
} elseif {!$create && $merge_type eq {none}} {
|
||||
# We aren't creating, it exists and we don't merge.
|
||||
@@ -203,7 +203,7 @@ method _update_ref {} {
|
||||
set new $cur
|
||||
set new_hash $cur
|
||||
} else {
|
||||
_error $this "Branch '$newbranch' already exists.\n\nIt cannot fast-forward to $new_expr.\nA merge is required."
|
||||
_error $this [mc "Branch '%s' already exists.\n\nIt cannot fast-forward to %s.\nA merge is required." $newbranch $new_expr]
|
||||
return 0
|
||||
}
|
||||
}
|
||||
@@ -217,7 +217,7 @@ method _update_ref {} {
|
||||
}
|
||||
}
|
||||
default {
|
||||
_error $this "Merge strategy '$merge_type' not supported."
|
||||
_error $this [mc "Merge strategy '%s' not supported." $merge_type]
|
||||
return 0
|
||||
}
|
||||
}
|
||||
@@ -236,7 +236,7 @@ method _update_ref {} {
|
||||
if {[catch {
|
||||
git update-ref -m $reflog_msg $ref $new $cur
|
||||
} err]} {
|
||||
_error $this "Failed to update '$newbranch'.\n\n$err"
|
||||
_error $this [strcat [mc "Failed to update '%s'." $newbranch] "\n\n$err"]
|
||||
return 0
|
||||
}
|
||||
}
|
||||
@@ -248,7 +248,7 @@ method _checkout {} {
|
||||
if {[lock_index checkout_op]} {
|
||||
after idle [cb _start_checkout]
|
||||
} else {
|
||||
_error $this "Staging area (index) is already locked."
|
||||
_error $this [mc "Staging area (index) is already locked."]
|
||||
delete_this
|
||||
}
|
||||
}
|
||||
@@ -263,12 +263,12 @@ method _start_checkout {} {
|
||||
&& $curType eq {normal}
|
||||
&& $curHEAD eq $HEAD} {
|
||||
} elseif {$commit_type ne $curType || $HEAD ne $curHEAD} {
|
||||
info_popup {Last scanned state does not match repository state.
|
||||
info_popup [mc "Last scanned state does not match repository state.
|
||||
|
||||
Another Git program has modified this repository since the last scan. A rescan must be performed before the current branch can be changed.
|
||||
|
||||
The rescan will be automatically started now.
|
||||
}
|
||||
"]
|
||||
unlock_index
|
||||
rescan ui_ready
|
||||
delete_this
|
||||
@@ -319,7 +319,7 @@ method _readtree {} {
|
||||
|
||||
set readtree_d {}
|
||||
$::main_status start \
|
||||
"Updating working directory to '[_name $this]'..." \
|
||||
[mc "Updating working directory to '%s'..." [_name $this]] \
|
||||
{files checked out}
|
||||
|
||||
set fd [git_read --stderr read-tree \
|
||||
@@ -350,12 +350,12 @@ method _readtree_wait {fd} {
|
||||
if {[catch {close $fd}]} {
|
||||
set err $readtree_d
|
||||
regsub {^fatal: } $err {} err
|
||||
$::main_status stop "Aborted checkout of '[_name $this]' (file level merging is required)."
|
||||
warn_popup "File level merge required.
|
||||
$::main_status stop [mc "Aborted checkout of '%s' (file level merging is required)." [_name $this]]
|
||||
warn_popup [strcat [mc "File level merge required."] "
|
||||
|
||||
$err
|
||||
|
||||
Staying on branch '$current_branch'."
|
||||
" [mc "Staying on branch '%s'." $current_branch]]
|
||||
unlock_index
|
||||
delete_this
|
||||
return
|
||||
@@ -426,9 +426,9 @@ method _after_readtree {} {
|
||||
}
|
||||
|
||||
if {$is_detached} {
|
||||
info_popup "You are no longer on a local branch.
|
||||
info_popup [mc "You are no longer on a local branch.
|
||||
|
||||
If you wanted to be on a branch, create one now starting from 'This Detached Checkout'."
|
||||
If you wanted to be on a branch, create one now starting from 'This Detached Checkout'."]
|
||||
}
|
||||
|
||||
# -- Update our repository state. If we were previously in
|
||||
@@ -443,7 +443,7 @@ If you wanted to be on a branch, create one now starting from 'This Detached Che
|
||||
$ui_comm delete 0.0 end
|
||||
$ui_comm edit reset
|
||||
$ui_comm edit modified false
|
||||
rescan [list ui_status "Checked out '$name'."]
|
||||
rescan [list ui_status [mc "Checked out '%s'." $name]]
|
||||
} else {
|
||||
repository_state commit_type HEAD MERGE_HEAD
|
||||
set PARENT $HEAD
|
||||
@@ -475,7 +475,7 @@ method _confirm_reset {cur} {
|
||||
pack [label $w.msg1 \
|
||||
-anchor w \
|
||||
-justify left \
|
||||
-text "Resetting '$name' to $new_expr will lose the following commits:" \
|
||||
-text [mc "Resetting '%s' to '%s' will lose the following commits:" $name $new_expr]\
|
||||
] -anchor w
|
||||
|
||||
set list $w.list.l
|
||||
@@ -497,21 +497,21 @@ method _confirm_reset {cur} {
|
||||
pack [label $w.msg2 \
|
||||
-anchor w \
|
||||
-justify left \
|
||||
-text {Recovering lost commits may not be easy.} \
|
||||
-text [mc "Recovering lost commits may not be easy."] \
|
||||
]
|
||||
pack [label $w.msg3 \
|
||||
-anchor w \
|
||||
-justify left \
|
||||
-text "Reset '$name'?" \
|
||||
-text [mc "Reset '%s'?" $name] \
|
||||
]
|
||||
|
||||
frame $w.buttons
|
||||
button $w.buttons.visualize \
|
||||
-text Visualize \
|
||||
-text [mc Visualize] \
|
||||
-command $gitk
|
||||
pack $w.buttons.visualize -side left
|
||||
button $w.buttons.reset \
|
||||
-text Reset \
|
||||
-text [mc Reset] \
|
||||
-command "
|
||||
set @reset_ok 1
|
||||
destroy $w
|
||||
@@ -519,7 +519,7 @@ method _confirm_reset {cur} {
|
||||
pack $w.buttons.reset -side right
|
||||
button $w.buttons.cancel \
|
||||
-default active \
|
||||
-text Cancel \
|
||||
-text [mc Cancel] \
|
||||
-command [list destroy $w]
|
||||
pack $w.buttons.cancel -side right -padx 5
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
@@ -575,13 +575,13 @@ method _toplevel {title} {
|
||||
}
|
||||
|
||||
method _fatal {err} {
|
||||
error_popup "Failed to set current branch.
|
||||
error_popup [strcat [mc "Failed to set current branch.
|
||||
|
||||
This working directory is only partially switched. We successfully updated your files, but failed to update an internal Git file.
|
||||
|
||||
This should not have occurred. [appname] will now close and give up.
|
||||
This should not have occurred. %s will now close and give up." [appname]] "
|
||||
|
||||
$err"
|
||||
$err"]
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
1044
git-gui/lib/choose_repository.tcl
Normal file
1044
git-gui/lib/choose_repository.tcl
Normal file
File diff suppressed because it is too large
Load Diff
@@ -50,14 +50,14 @@ constructor _new {path unmerged_only title} {
|
||||
if {$is_detached} {
|
||||
radiobutton $w.detachedhead_r \
|
||||
-anchor w \
|
||||
-text {This Detached Checkout} \
|
||||
-text [mc "This Detached Checkout"] \
|
||||
-value HEAD \
|
||||
-variable @revtype
|
||||
grid $w.detachedhead_r -sticky we -padx {0 5} -columnspan 2
|
||||
}
|
||||
|
||||
radiobutton $w.expr_r \
|
||||
-text {Revision Expression:} \
|
||||
-text [mc "Revision Expression:"] \
|
||||
-value expr \
|
||||
-variable @revtype
|
||||
entry $w.expr_t \
|
||||
@@ -71,17 +71,17 @@ constructor _new {path unmerged_only title} {
|
||||
|
||||
frame $w.types
|
||||
radiobutton $w.types.head_r \
|
||||
-text {Local Branch} \
|
||||
-text [mc "Local Branch"] \
|
||||
-value head \
|
||||
-variable @revtype
|
||||
pack $w.types.head_r -side left
|
||||
radiobutton $w.types.trck_r \
|
||||
-text {Tracking Branch} \
|
||||
-text [mc "Tracking Branch"] \
|
||||
-value trck \
|
||||
-variable @revtype
|
||||
pack $w.types.trck_r -side left
|
||||
radiobutton $w.types.tag_r \
|
||||
-text {Tag} \
|
||||
-text [mc "Tag"] \
|
||||
-value tag \
|
||||
-variable @revtype
|
||||
pack $w.types.tag_r -side left
|
||||
@@ -133,13 +133,13 @@ constructor _new {path unmerged_only title} {
|
||||
append fmt { %(objecttype)}
|
||||
append fmt { %(objectname)}
|
||||
append fmt { [concat %(taggername) %(authorname)]}
|
||||
append fmt { [concat %(taggerdate) %(authordate)]}
|
||||
append fmt { [reformat_date [concat %(taggerdate) %(authordate)]]}
|
||||
append fmt { %(subject)}
|
||||
append fmt {] [list}
|
||||
append fmt { %(*objecttype)}
|
||||
append fmt { %(*objectname)}
|
||||
append fmt { %(*authorname)}
|
||||
append fmt { %(*authordate)}
|
||||
append fmt { [reformat_date %(*authordate)]}
|
||||
append fmt { %(*subject)}
|
||||
append fmt {]}
|
||||
set all_refn [list]
|
||||
@@ -314,7 +314,7 @@ method commit_or_die {} {
|
||||
}
|
||||
|
||||
set top [winfo toplevel $w]
|
||||
set msg "Invalid revision: [get $this]\n\n$err"
|
||||
set msg [strcat [mc "Invalid revision: %s" [get $this]] "\n\n$err"]
|
||||
tk_messageBox \
|
||||
-icon error \
|
||||
-type ok \
|
||||
@@ -335,7 +335,7 @@ method _expr {} {
|
||||
if {$i ne {}} {
|
||||
return [lindex $cur_specs $i 1]
|
||||
} else {
|
||||
error "No revision selected."
|
||||
error [mc "No revision selected."]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ method _expr {} {
|
||||
if {$c_expr ne {}} {
|
||||
return $c_expr
|
||||
} else {
|
||||
error "Revision expression is empty."
|
||||
error [mc "Revision expression is empty."]
|
||||
}
|
||||
}
|
||||
HEAD { return HEAD }
|
||||
@@ -527,14 +527,14 @@ method _open_tooltip {} {
|
||||
set last [_reflog_last $this [lindex $spec 1]]
|
||||
if {$last ne {}} {
|
||||
$tooltip_t insert end "\n"
|
||||
$tooltip_t insert end "updated"
|
||||
$tooltip_t insert end [mc "Updated"]
|
||||
$tooltip_t insert end " $last"
|
||||
}
|
||||
$tooltip_t insert end "\n"
|
||||
|
||||
if {$tag ne {}} {
|
||||
$tooltip_t insert end "\n"
|
||||
$tooltip_t insert end "tag" section_header
|
||||
$tooltip_t insert end [mc "Tag"] section_header
|
||||
$tooltip_t insert end " [lindex $tag 1]\n"
|
||||
$tooltip_t insert end [lindex $tag 2]
|
||||
$tooltip_t insert end " ([lindex $tag 3])\n"
|
||||
@@ -544,7 +544,7 @@ method _open_tooltip {} {
|
||||
|
||||
if {$cmit ne {}} {
|
||||
$tooltip_t insert end "\n"
|
||||
$tooltip_t insert end "commit" section_header
|
||||
$tooltip_t insert end [mc "Commit@@noun"] section_header
|
||||
$tooltip_t insert end " [lindex $cmit 1]\n"
|
||||
$tooltip_t insert end [lindex $cmit 2]
|
||||
$tooltip_t insert end " ([lindex $cmit 3])\n"
|
||||
@@ -553,11 +553,11 @@ method _open_tooltip {} {
|
||||
|
||||
if {[llength $spec] > 2} {
|
||||
$tooltip_t insert end "\n"
|
||||
$tooltip_t insert end "remote" section_header
|
||||
$tooltip_t insert end [mc "Remote"] section_header
|
||||
$tooltip_t insert end " [lindex $spec 2]\n"
|
||||
$tooltip_t insert end "url"
|
||||
$tooltip_t insert end [mc "URL"]
|
||||
$tooltip_t insert end " $remote_url([lindex $spec 2])\n"
|
||||
$tooltip_t insert end "branch"
|
||||
$tooltip_t insert end [mc "Branch"]
|
||||
$tooltip_t insert end " [lindex $spec 3]"
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ method _reflog_last {name} {
|
||||
}
|
||||
|
||||
if {$last ne {}} {
|
||||
set last [clock format $last -format {%a %b %e %H:%M:%S %Y}]
|
||||
set last [format_date $last]
|
||||
}
|
||||
set reflog_last($name) $last
|
||||
return $last
|
||||
|
||||
@@ -6,19 +6,19 @@ proc load_last_commit {} {
|
||||
global repo_config
|
||||
|
||||
if {[llength $PARENT] == 0} {
|
||||
error_popup {There is nothing to amend.
|
||||
error_popup [mc "There is nothing to amend.
|
||||
|
||||
You are about to create the initial commit. There is no commit before this to amend.
|
||||
}
|
||||
"]
|
||||
return
|
||||
}
|
||||
|
||||
repository_state curType curHEAD curMERGE_HEAD
|
||||
if {$curType eq {merge}} {
|
||||
error_popup {Cannot amend while merging.
|
||||
error_popup [mc "Cannot amend while merging.
|
||||
|
||||
You are currently in the middle of a merge that has not been fully completed. You cannot amend the prior commit unless you first abort the current merge activity.
|
||||
}
|
||||
"]
|
||||
return
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ You are currently in the middle of a merge that has not been fully completed. Y
|
||||
}
|
||||
set msg [string trim $msg]
|
||||
} err]} {
|
||||
error_popup "Error loading commit data for amend:\n\n$err"
|
||||
error_popup [strcat [mc "Error loading commit data for amend:"] "\n\n$err"]
|
||||
return
|
||||
}
|
||||
|
||||
@@ -73,12 +73,12 @@ proc committer_ident {} {
|
||||
|
||||
if {$GIT_COMMITTER_IDENT eq {}} {
|
||||
if {[catch {set me [git var GIT_COMMITTER_IDENT]} err]} {
|
||||
error_popup "Unable to obtain your identity:\n\n$err"
|
||||
error_popup [strcat [mc "Unable to obtain your identity:"] "\n\n$err"]
|
||||
return {}
|
||||
}
|
||||
if {![regexp {^(.*) [0-9]+ [-+0-9]+$} \
|
||||
$me me GIT_COMMITTER_IDENT]} {
|
||||
error_popup "Invalid GIT_COMMITTER_IDENT:\n\n$me"
|
||||
error_popup [strcat [mc "Invalid GIT_COMMITTER_IDENT:"] "\n\n$me"]
|
||||
return {}
|
||||
}
|
||||
}
|
||||
@@ -130,12 +130,12 @@ proc commit_tree {} {
|
||||
&& $curType eq {normal}
|
||||
&& $curHEAD eq $HEAD} {
|
||||
} elseif {$commit_type ne $curType || $HEAD ne $curHEAD} {
|
||||
info_popup {Last scanned state does not match repository state.
|
||||
info_popup [mc "Last scanned state does not match repository state.
|
||||
|
||||
Another Git program has modified this repository since the last scan. A rescan must be performed before another commit can be created.
|
||||
|
||||
The rescan will be automatically started now.
|
||||
}
|
||||
"]
|
||||
unlock_index
|
||||
rescan ui_ready
|
||||
return
|
||||
@@ -151,26 +151,26 @@ The rescan will be automatically started now.
|
||||
D? -
|
||||
M? {set files_ready 1}
|
||||
U? {
|
||||
error_popup "Unmerged files cannot be committed.
|
||||
error_popup [mc "Unmerged files cannot be committed.
|
||||
|
||||
File [short_path $path] has merge conflicts. You must resolve them and stage the file before committing.
|
||||
"
|
||||
File %s has merge conflicts. You must resolve them and stage the file before committing.
|
||||
" [short_path $path]]
|
||||
unlock_index
|
||||
return
|
||||
}
|
||||
default {
|
||||
error_popup "Unknown file state [lindex $s 0] detected.
|
||||
error_popup [mc "Unknown file state %s detected.
|
||||
|
||||
File [short_path $path] cannot be committed by this program.
|
||||
"
|
||||
File %s cannot be committed by this program.
|
||||
" [lindex $s 0] [short_path $path]]
|
||||
}
|
||||
}
|
||||
}
|
||||
if {!$files_ready && ![string match *merge $curType]} {
|
||||
info_popup {No changes to commit.
|
||||
info_popup [mc "No changes to commit.
|
||||
|
||||
You must stage at least 1 file before you can commit.
|
||||
}
|
||||
"]
|
||||
unlock_index
|
||||
return
|
||||
}
|
||||
@@ -180,14 +180,14 @@ You must stage at least 1 file before you can commit.
|
||||
set msg [string trim [$ui_comm get 1.0 end]]
|
||||
regsub -all -line {[ \t\r]+$} $msg {} msg
|
||||
if {$msg eq {}} {
|
||||
error_popup {Please supply a commit message.
|
||||
error_popup [mc "Please supply a commit message.
|
||||
|
||||
A good commit message has the following format:
|
||||
|
||||
- First line: Describe in one sentance what you did.
|
||||
- Second line: Blank
|
||||
- Remaining lines: Describe why this change is good.
|
||||
}
|
||||
"]
|
||||
unlock_index
|
||||
return
|
||||
}
|
||||
@@ -254,7 +254,7 @@ proc commit_committree {fd_wt curHEAD msg} {
|
||||
|
||||
gets $fd_wt tree_id
|
||||
if {[catch {close $fd_wt} err]} {
|
||||
error_popup "write-tree failed:\n\n$err"
|
||||
error_popup [strcat [mc "write-tree failed:"] "\n\n$err"]
|
||||
ui_status {Commit failed.}
|
||||
unlock_index
|
||||
return
|
||||
@@ -272,18 +272,18 @@ proc commit_committree {fd_wt curHEAD msg} {
|
||||
&& [string length $old_tree] == 45} {
|
||||
set old_tree [string range $old_tree 5 end]
|
||||
} else {
|
||||
error "Commit $PARENT appears to be corrupt"
|
||||
error [mc "Commit %s appears to be corrupt" $PARENT]
|
||||
}
|
||||
|
||||
if {$tree_id eq $old_tree} {
|
||||
info_popup {No changes to commit.
|
||||
info_popup [mc "No changes to commit.
|
||||
|
||||
No files were modified by this commit and it was not a merge commit.
|
||||
|
||||
A rescan will be automatically started now.
|
||||
}
|
||||
"]
|
||||
unlock_index
|
||||
rescan {ui_status {No changes to commit.}}
|
||||
rescan {ui_status [mc "No changes to commit."]}
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -300,7 +300,7 @@ A rescan will be automatically started now.
|
||||
if {$use_enc ne {}} {
|
||||
fconfigure $msg_wt -encoding $use_enc
|
||||
} else {
|
||||
puts stderr "warning: Tcl does not support encoding '$enc'."
|
||||
puts stderr [mc "warning: Tcl does not support encoding '%s'." $enc]
|
||||
fconfigure $msg_wt -encoding utf-8
|
||||
}
|
||||
puts -nonewline $msg_wt $msg
|
||||
@@ -314,7 +314,7 @@ A rescan will be automatically started now.
|
||||
}
|
||||
lappend cmd <$msg_p
|
||||
if {[catch {set cmt_id [eval git $cmd]} err]} {
|
||||
error_popup "commit-tree failed:\n\n$err"
|
||||
error_popup [strcat [mc "commit-tree failed:"] "\n\n$err"]
|
||||
ui_status {Commit failed.}
|
||||
unlock_index
|
||||
return
|
||||
@@ -336,7 +336,7 @@ A rescan will be automatically started now.
|
||||
if {[catch {
|
||||
git update-ref -m $reflogm HEAD $cmt_id $curHEAD
|
||||
} err]} {
|
||||
error_popup "update-ref failed:\n\n$err"
|
||||
error_popup [strcat [mc "update-ref failed:"] "\n\n$err"]
|
||||
ui_status {Commit failed.}
|
||||
unlock_index
|
||||
return
|
||||
@@ -427,5 +427,5 @@ A rescan will be automatically started now.
|
||||
display_all_files
|
||||
unlock_index
|
||||
reshow_diff
|
||||
ui_status "Created commit [string range $cmt_id 0 7]: $subject"
|
||||
ui_status [mc "Created commit %s: %s" [string range $cmt_id 0 7] $subject]
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ class console {
|
||||
field t_short
|
||||
field t_long
|
||||
field w
|
||||
field w_t
|
||||
field console_cr
|
||||
field is_toplevel 1; # are we our own window?
|
||||
|
||||
@@ -36,6 +37,7 @@ method _init {} {
|
||||
}
|
||||
|
||||
set console_cr 1.0
|
||||
set w_t $w.m.t
|
||||
|
||||
frame $w.m
|
||||
label $w.m.l1 \
|
||||
@@ -43,51 +45,47 @@ method _init {} {
|
||||
-anchor w \
|
||||
-justify left \
|
||||
-font font_uibold
|
||||
text $w.m.t \
|
||||
text $w_t \
|
||||
-background white -borderwidth 1 \
|
||||
-relief sunken \
|
||||
-width 80 -height 10 \
|
||||
-wrap none \
|
||||
-font font_diff \
|
||||
-state disabled \
|
||||
-xscrollcommand [list $w.m.sbx set] \
|
||||
-yscrollcommand [list $w.m.sby set]
|
||||
label $w.m.s -text {Working... please wait...} \
|
||||
-xscrollcommand [cb _sb_set $w.m.sbx h] \
|
||||
-yscrollcommand [cb _sb_set $w.m.sby v]
|
||||
label $w.m.s -text [mc "Working... please wait..."] \
|
||||
-anchor w \
|
||||
-justify left \
|
||||
-font font_uibold
|
||||
scrollbar $w.m.sbx -command [list $w.m.t xview] -orient h
|
||||
scrollbar $w.m.sby -command [list $w.m.t yview]
|
||||
pack $w.m.l1 -side top -fill x
|
||||
pack $w.m.s -side bottom -fill x
|
||||
pack $w.m.sbx -side bottom -fill x
|
||||
pack $w.m.sby -side right -fill y
|
||||
pack $w.m.t -side left -fill both -expand 1
|
||||
pack $w_t -side left -fill both -expand 1
|
||||
pack $w.m -side top -fill both -expand 1 -padx 5 -pady 10
|
||||
|
||||
menu $w.ctxm -tearoff 0
|
||||
$w.ctxm add command -label "Copy" \
|
||||
-command "tk_textCopy $w.m.t"
|
||||
$w.ctxm add command -label "Select All" \
|
||||
-command "focus $w.m.t;$w.m.t tag add sel 0.0 end"
|
||||
$w.ctxm add command -label "Copy All" \
|
||||
$w.ctxm add command -label [mc "Copy"] \
|
||||
-command "tk_textCopy $w_t"
|
||||
$w.ctxm add command -label [mc "Select All"] \
|
||||
-command "focus $w_t;$w_t tag add sel 0.0 end"
|
||||
$w.ctxm add command -label [mc "Copy All"] \
|
||||
-command "
|
||||
$w.m.t tag add sel 0.0 end
|
||||
tk_textCopy $w.m.t
|
||||
$w.m.t tag remove sel 0.0 end
|
||||
$w_t tag add sel 0.0 end
|
||||
tk_textCopy $w_t
|
||||
$w_t tag remove sel 0.0 end
|
||||
"
|
||||
|
||||
if {$is_toplevel} {
|
||||
button $w.ok -text {Close} \
|
||||
button $w.ok -text [mc "Close"] \
|
||||
-state disabled \
|
||||
-command [list destroy $w]
|
||||
pack $w.ok -side bottom -anchor e -pady 10 -padx 10
|
||||
bind $w <Visibility> [list focus $w]
|
||||
}
|
||||
|
||||
bind_button3 $w.m.t "tk_popup $w.ctxm %X %Y"
|
||||
bind $w.m.t <$M1B-Key-a> "$w.m.t tag add sel 0.0 end;break"
|
||||
bind $w.m.t <$M1B-Key-A> "$w.m.t tag add sel 0.0 end;break"
|
||||
bind_button3 $w_t "tk_popup $w.ctxm %X %Y"
|
||||
bind $w_t <$M1B-Key-a> "$w_t tag add sel 0.0 end;break"
|
||||
bind $w_t <$M1B-Key-A> "$w_t tag add sel 0.0 end;break"
|
||||
}
|
||||
|
||||
method exec {cmd {after {}}} {
|
||||
@@ -104,8 +102,8 @@ method exec {cmd {after {}}} {
|
||||
method _read {fd after} {
|
||||
set buf [read $fd]
|
||||
if {$buf ne {}} {
|
||||
if {![winfo exists $w.m.t]} {_init $this}
|
||||
$w.m.t conf -state normal
|
||||
if {![winfo exists $w_t]} {_init $this}
|
||||
$w_t conf -state normal
|
||||
set c 0
|
||||
set n [string length $buf]
|
||||
while {$c < $n} {
|
||||
@@ -115,20 +113,20 @@ method _read {fd after} {
|
||||
if {$lf < 0} {set lf [expr {$n + 1}]}
|
||||
|
||||
if {$lf < $cr} {
|
||||
$w.m.t insert end [string range $buf $c $lf]
|
||||
set console_cr [$w.m.t index {end -1c}]
|
||||
$w_t insert end [string range $buf $c $lf]
|
||||
set console_cr [$w_t index {end -1c}]
|
||||
set c $lf
|
||||
incr c
|
||||
} else {
|
||||
$w.m.t delete $console_cr end
|
||||
$w.m.t insert end "\n"
|
||||
$w.m.t insert end [string range $buf $c [expr {$cr - 1}]]
|
||||
$w_t delete $console_cr end
|
||||
$w_t insert end "\n"
|
||||
$w_t insert end [string range $buf $c [expr {$cr - 1}]]
|
||||
set c $cr
|
||||
incr c
|
||||
}
|
||||
}
|
||||
$w.m.t conf -state disabled
|
||||
$w.m.t see end
|
||||
$w_t conf -state disabled
|
||||
$w_t see end
|
||||
}
|
||||
|
||||
fconfigure $fd -blocking 1
|
||||
@@ -171,33 +169,50 @@ method chain {cmdlist {ok 1}} {
|
||||
}
|
||||
|
||||
method insert {txt} {
|
||||
if {![winfo exists $w.m.t]} {_init $this}
|
||||
$w.m.t conf -state normal
|
||||
$w.m.t insert end "$txt\n"
|
||||
set console_cr [$w.m.t index {end -1c}]
|
||||
$w.m.t conf -state disabled
|
||||
if {![winfo exists $w_t]} {_init $this}
|
||||
$w_t conf -state normal
|
||||
$w_t insert end "$txt\n"
|
||||
set console_cr [$w_t index {end -1c}]
|
||||
$w_t conf -state disabled
|
||||
}
|
||||
|
||||
method done {ok} {
|
||||
if {$ok} {
|
||||
if {[winfo exists $w.m.s]} {
|
||||
$w.m.s conf -background green -text {Success}
|
||||
bind $w.m.s <Destroy> [list delete_this $this]
|
||||
$w.m.s conf -background green -text [mc "Success"]
|
||||
if {$is_toplevel} {
|
||||
$w.ok conf -state normal
|
||||
focus $w.ok
|
||||
}
|
||||
} else {
|
||||
delete_this
|
||||
}
|
||||
} else {
|
||||
if {![winfo exists $w.m.s]} {
|
||||
_init $this
|
||||
}
|
||||
$w.m.s conf -background red -text {Error: Command Failed}
|
||||
bind $w.m.s <Destroy> [list delete_this $this]
|
||||
$w.m.s conf -background red -text [mc "Error: Command Failed"]
|
||||
if {$is_toplevel} {
|
||||
$w.ok conf -state normal
|
||||
focus $w.ok
|
||||
}
|
||||
}
|
||||
delete_this
|
||||
}
|
||||
|
||||
method _sb_set {sb orient first last} {
|
||||
if {![winfo exists $sb]} {
|
||||
if {$first == $last || ($first == 0 && $last == 1)} return
|
||||
if {$orient eq {h}} {
|
||||
scrollbar $sb -orient h -command [list $w_t xview]
|
||||
pack $sb -fill x -side bottom -before $w_t
|
||||
} else {
|
||||
scrollbar $sb -orient v -command [list $w_t yview]
|
||||
pack $sb -fill y -side right -before $w_t
|
||||
}
|
||||
}
|
||||
$sb set $first $last
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@ proc do_stats {} {
|
||||
toplevel $w
|
||||
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
|
||||
|
||||
label $w.header -text {Database Statistics}
|
||||
label $w.header -text [mc "Database Statistics"]
|
||||
pack $w.header -side top -fill x
|
||||
|
||||
frame $w.buttons -border 1
|
||||
button $w.buttons.close -text Close \
|
||||
button $w.buttons.close -text [mc Close] \
|
||||
-default active \
|
||||
-command [list destroy $w]
|
||||
button $w.buttons.gc -text {Compress Database} \
|
||||
button $w.buttons.gc -text [mc "Compress Database"] \
|
||||
-default normal \
|
||||
-command "destroy $w;do_gc"
|
||||
pack $w.buttons.close -side right
|
||||
@@ -40,16 +40,16 @@ proc do_stats {} {
|
||||
|
||||
frame $w.stat -borderwidth 1 -relief solid
|
||||
foreach s {
|
||||
{count {Number of loose objects}}
|
||||
{size {Disk space used by loose objects} { KiB}}
|
||||
{in-pack {Number of packed objects}}
|
||||
{packs {Number of packs}}
|
||||
{size-pack {Disk space used by packed objects} { KiB}}
|
||||
{prune-packable {Packed objects waiting for pruning}}
|
||||
{garbage {Garbage files}}
|
||||
{count {mc "Number of loose objects"}}
|
||||
{size {mc "Disk space used by loose objects"} { KiB}}
|
||||
{in-pack {mc "Number of packed objects"}}
|
||||
{packs {mc "Number of packs"}}
|
||||
{size-pack {mc "Disk space used by packed objects"} { KiB}}
|
||||
{prune-packable {mc "Packed objects waiting for pruning"}}
|
||||
{garbage {mc "Garbage files"}}
|
||||
} {
|
||||
set name [lindex $s 0]
|
||||
set label [lindex $s 1]
|
||||
set label [eval [lindex $s 1]]
|
||||
if {[catch {set value $stats($name)}]} continue
|
||||
if {[llength $s] > 2} {
|
||||
set value "$value[lindex $s 2]"
|
||||
@@ -64,12 +64,12 @@ proc do_stats {} {
|
||||
bind $w <Visibility> "grab $w; focus $w.buttons.close"
|
||||
bind $w <Key-Escape> [list destroy $w]
|
||||
bind $w <Key-Return> [list destroy $w]
|
||||
wm title $w "[appname] ([reponame]): Database Statistics"
|
||||
wm title $w [append "[appname] ([reponame]): " [mc "Database Statistics"]]
|
||||
tkwait window $w
|
||||
}
|
||||
|
||||
proc do_gc {} {
|
||||
set w [console::new {gc} {Compressing the object database}]
|
||||
set w [console::new {gc} [mc "Compressing the object database"]]
|
||||
console::chain $w {
|
||||
{exec git pack-refs --prune}
|
||||
{exec git reflog expire --all}
|
||||
@@ -80,7 +80,7 @@ proc do_gc {} {
|
||||
|
||||
proc do_fsck_objects {} {
|
||||
set w [console::new {fsck-objects} \
|
||||
{Verifying the object database with fsck-objects}]
|
||||
[mc "Verifying the object database with fsck-objects"]]
|
||||
set cmd [list git fsck-objects]
|
||||
lappend cmd --full
|
||||
lappend cmd --cache
|
||||
@@ -105,11 +105,11 @@ proc hint_gc {} {
|
||||
set objects_current [expr {$objects_current * 256}]
|
||||
set object_limit [expr {$object_limit * 256}]
|
||||
if {[ask_popup \
|
||||
"This repository currently has approximately $objects_current loose objects.
|
||||
[mc "This repository currently has approximately %i loose objects.
|
||||
|
||||
To maintain optimal performance it is strongly recommended that you compress the database when more than $object_limit loose objects exist.
|
||||
To maintain optimal performance it is strongly recommended that you compress the database when more than %i loose objects exist.
|
||||
|
||||
Compress the database now?"] eq yes} {
|
||||
Compress the database now?" $objects_current $object_limit]] eq yes} {
|
||||
do_gc
|
||||
}
|
||||
}
|
||||
|
||||
53
git-gui/lib/date.tcl
Normal file
53
git-gui/lib/date.tcl
Normal file
@@ -0,0 +1,53 @@
|
||||
# git-gui date processing support
|
||||
# Copyright (C) 2007 Shawn Pearce
|
||||
|
||||
set git_month(Jan) 1
|
||||
set git_month(Feb) 2
|
||||
set git_month(Mar) 3
|
||||
set git_month(Apr) 4
|
||||
set git_month(May) 5
|
||||
set git_month(Jun) 6
|
||||
set git_month(Jul) 7
|
||||
set git_month(Aug) 8
|
||||
set git_month(Sep) 9
|
||||
set git_month(Oct) 10
|
||||
set git_month(Nov) 11
|
||||
set git_month(Dec) 12
|
||||
|
||||
proc parse_git_date {s} {
|
||||
if {$s eq {}} {
|
||||
return {}
|
||||
}
|
||||
|
||||
if {![regexp \
|
||||
{^... (...) (\d{1,2}) (\d\d):(\d\d):(\d\d) (\d{4}) ([+-]?)(\d\d)(\d\d)$} $s s \
|
||||
month day hr mm ss yr ew tz_h tz_m]} {
|
||||
error [mc "Invalid date from Git: %s" $s]
|
||||
}
|
||||
|
||||
set s [clock scan [format {%4.4i%2.2i%2.2iT%2s%2s%2s} \
|
||||
$yr $::git_month($month) $day \
|
||||
$hr $mm $ss] \
|
||||
-gmt 1]
|
||||
|
||||
regsub ^0 $tz_h {} tz_h
|
||||
regsub ^0 $tz_m {} tz_m
|
||||
switch -- $ew {
|
||||
- {set ew +}
|
||||
+ {set ew -}
|
||||
{} {set ew -}
|
||||
}
|
||||
|
||||
return [expr "$s $ew ($tz_h * 3600 + $tz_m * 60)"]
|
||||
}
|
||||
|
||||
proc format_date {s} {
|
||||
if {$s eq {}} {
|
||||
return {}
|
||||
}
|
||||
return [clock format $s -format {%a %b %e %H:%M:%S %Y}]
|
||||
}
|
||||
|
||||
proc reformat_date {s} {
|
||||
return [format_date [parse_git_date $s]]
|
||||
}
|
||||
@@ -39,13 +39,13 @@ proc handle_empty_diff {} {
|
||||
set s $file_states($path)
|
||||
if {[lindex $s 0] ne {_M}} return
|
||||
|
||||
info_popup "No differences detected.
|
||||
info_popup [mc "No differences detected.
|
||||
|
||||
[short_path $path] has no changes.
|
||||
%s has no changes.
|
||||
|
||||
The modification date of this file was updated by another application, but the content within the file was not changed.
|
||||
|
||||
A rescan will be automatically started to find other files which may have the same state."
|
||||
A rescan will be automatically started to find other files which may have the same state." [short_path $path]]
|
||||
|
||||
clear_diff
|
||||
display_file $path __
|
||||
@@ -78,7 +78,7 @@ proc show_diff {path w {lno {}}} {
|
||||
set current_diff_path $path
|
||||
set current_diff_side $w
|
||||
set current_diff_header {}
|
||||
ui_status "Loading diff of [escape_path $path]..."
|
||||
ui_status [mc "Loading diff of %s..." [escape_path $path]]
|
||||
|
||||
# - Git won't give us the diff, there's nothing to compare to!
|
||||
#
|
||||
@@ -111,13 +111,16 @@ proc show_diff {path w {lno {}}} {
|
||||
} err ]} {
|
||||
set diff_active 0
|
||||
unlock_index
|
||||
ui_status "Unable to display [escape_path $path]"
|
||||
error_popup "Error loading file:\n\n$err"
|
||||
ui_status [mc "Unable to display %s" [escape_path $path]]
|
||||
error_popup [strcat [mc "Error loading file:"] "\n\n$err"]
|
||||
return
|
||||
}
|
||||
$ui_diff conf -state normal
|
||||
if {$type eq {submodule}} {
|
||||
$ui_diff insert end "* Git Repository (subproject)\n" d_@
|
||||
$ui_diff insert end [append \
|
||||
"* " \
|
||||
[mc "Git Repository (subproject)"] \
|
||||
"\n"] d_@
|
||||
} elseif {![catch {set type [exec file $path]}]} {
|
||||
set n [string length $path]
|
||||
if {[string equal -length $n $path $type]} {
|
||||
@@ -128,7 +131,7 @@ proc show_diff {path w {lno {}}} {
|
||||
}
|
||||
if {[string first "\0" $content] != -1} {
|
||||
$ui_diff insert end \
|
||||
"* Binary file (not showing content)." \
|
||||
[mc "* Binary file (not showing content)."] \
|
||||
d_@
|
||||
} else {
|
||||
if {$sz > $max_sz} {
|
||||
@@ -178,8 +181,8 @@ proc show_diff {path w {lno {}}} {
|
||||
if {[catch {set fd [eval git_read --nice $cmd]} err]} {
|
||||
set diff_active 0
|
||||
unlock_index
|
||||
ui_status "Unable to display [escape_path $path]"
|
||||
error_popup "Error loading diff:\n\n$err"
|
||||
ui_status [mc "Unable to display %s" [escape_path $path]]
|
||||
error_popup [strcat [mc "Error loading diff:"] "\n\n$err"]
|
||||
return
|
||||
}
|
||||
|
||||
@@ -296,14 +299,14 @@ proc apply_hunk {x y} {
|
||||
set apply_cmd {apply --cached --whitespace=nowarn}
|
||||
set mi [lindex $file_states($current_diff_path) 0]
|
||||
if {$current_diff_side eq $ui_index} {
|
||||
set mode unstage
|
||||
set failed_msg [mc "Failed to unstage selected hunk."]
|
||||
lappend apply_cmd --reverse
|
||||
if {[string index $mi 0] ne {M}} {
|
||||
unlock_index
|
||||
return
|
||||
}
|
||||
} else {
|
||||
set mode stage
|
||||
set failed_msg [mc "Failed to stage selected hunk."]
|
||||
if {[string index $mi 1] ne {M}} {
|
||||
unlock_index
|
||||
return
|
||||
@@ -328,7 +331,7 @@ proc apply_hunk {x y} {
|
||||
puts -nonewline $p $current_diff_header
|
||||
puts -nonewline $p [$ui_diff get $s_lno $e_lno]
|
||||
close $p} err]} {
|
||||
error_popup "Failed to $mode selected hunk.\n\n$err"
|
||||
error_popup [append $failed_msg "\n\n$err"]
|
||||
unlock_index
|
||||
return
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ proc error_popup {msg} {
|
||||
set cmd [list tk_messageBox \
|
||||
-icon error \
|
||||
-type ok \
|
||||
-title "$title: error" \
|
||||
-title [append "$title: " [mc "error"]] \
|
||||
-message $msg]
|
||||
if {[winfo ismapped .]} {
|
||||
lappend cmd -parent .
|
||||
@@ -25,7 +25,7 @@ proc warn_popup {msg} {
|
||||
set cmd [list tk_messageBox \
|
||||
-icon warning \
|
||||
-type ok \
|
||||
-title "$title: warning" \
|
||||
-title [append "$title: " [mc "warning"]] \
|
||||
-message $msg]
|
||||
if {[winfo ismapped .]} {
|
||||
lappend cmd -parent .
|
||||
@@ -78,7 +78,7 @@ proc hook_failed_popup {hook msg} {
|
||||
-font font_diff \
|
||||
-yscrollcommand [list $w.m.sby set]
|
||||
label $w.m.l2 \
|
||||
-text {You must correct the above errors before committing.} \
|
||||
-text [mc "You must correct the above errors before committing."] \
|
||||
-anchor w \
|
||||
-justify left \
|
||||
-font font_uibold
|
||||
@@ -99,6 +99,6 @@ proc hook_failed_popup {hook msg} {
|
||||
|
||||
bind $w <Visibility> "grab $w; focus $w"
|
||||
bind $w <Key-Return> "destroy $w"
|
||||
wm title $w "[appname] ([reponame]): error"
|
||||
wm title $w [append "[appname] ([reponame]): " [mc "error"]]
|
||||
tkwait window $w
|
||||
}
|
||||
|
||||
BIN
git-gui/lib/git-gui.ico
Normal file
BIN
git-gui/lib/git-gui.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 318 B |
@@ -1,6 +1,56 @@
|
||||
# git-gui index (add/remove) support
|
||||
# Copyright (C) 2006, 2007 Shawn Pearce
|
||||
|
||||
proc _delete_indexlock {} {
|
||||
if {[catch {file delete -- [gitdir index.lock]} err]} {
|
||||
error_popup [strcat [mc "Unable to unlock the index."] "\n\n$err"]
|
||||
}
|
||||
}
|
||||
|
||||
proc _close_updateindex {fd after} {
|
||||
fconfigure $fd -blocking 1
|
||||
if {[catch {close $fd} err]} {
|
||||
set w .indexfried
|
||||
toplevel $w
|
||||
wm title $w [strcat "[appname] ([reponame]): " [mc "Index Error"]]
|
||||
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
|
||||
pack [label $w.msg \
|
||||
-justify left \
|
||||
-anchor w \
|
||||
-text [strcat \
|
||||
[mc "Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui."] \
|
||||
"\n\n$err"] \
|
||||
] -anchor w
|
||||
|
||||
frame $w.buttons
|
||||
button $w.buttons.continue \
|
||||
-text [mc "Continue"] \
|
||||
-command [list destroy $w]
|
||||
pack $w.buttons.continue -side right -padx 5
|
||||
button $w.buttons.unlock \
|
||||
-text [mc "Unlock Index"] \
|
||||
-command "destroy $w; _delete_indexlock"
|
||||
pack $w.buttons.unlock -side right
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
wm protocol $w WM_DELETE_WINDOW update
|
||||
bind $w.buttons.continue <Visibility> "
|
||||
grab $w
|
||||
focus $w.buttons.continue
|
||||
"
|
||||
tkwait window $w
|
||||
|
||||
$::main_status stop
|
||||
unlock_index
|
||||
rescan $after 0
|
||||
return
|
||||
}
|
||||
|
||||
$::main_status stop
|
||||
unlock_index
|
||||
uplevel #0 $after
|
||||
}
|
||||
|
||||
proc update_indexinfo {msg pathList after} {
|
||||
global update_index_cp
|
||||
|
||||
@@ -12,12 +62,7 @@ proc update_indexinfo {msg pathList after} {
|
||||
set batch [expr {int($totalCnt * .01) + 1}]
|
||||
if {$batch > 25} {set batch 25}
|
||||
|
||||
ui_status [format \
|
||||
"%s... %i/%i files (%.2f%%)" \
|
||||
$msg \
|
||||
$update_index_cp \
|
||||
$totalCnt \
|
||||
0.0]
|
||||
$::main_status start $msg [mc "files"]
|
||||
set fd [git_write update-index -z --index-info]
|
||||
fconfigure $fd \
|
||||
-blocking 0 \
|
||||
@@ -31,19 +76,16 @@ proc update_indexinfo {msg pathList after} {
|
||||
$pathList \
|
||||
$totalCnt \
|
||||
$batch \
|
||||
$msg \
|
||||
$after \
|
||||
]
|
||||
}
|
||||
|
||||
proc write_update_indexinfo {fd pathList totalCnt batch msg after} {
|
||||
proc write_update_indexinfo {fd pathList totalCnt batch after} {
|
||||
global update_index_cp
|
||||
global file_states current_diff_path
|
||||
|
||||
if {$update_index_cp >= $totalCnt} {
|
||||
close $fd
|
||||
unlock_index
|
||||
uplevel #0 $after
|
||||
_close_updateindex $fd $after
|
||||
return
|
||||
}
|
||||
|
||||
@@ -68,12 +110,7 @@ proc write_update_indexinfo {fd pathList totalCnt batch msg after} {
|
||||
display_file $path $new
|
||||
}
|
||||
|
||||
ui_status [format \
|
||||
"%s... %i/%i files (%.2f%%)" \
|
||||
$msg \
|
||||
$update_index_cp \
|
||||
$totalCnt \
|
||||
[expr {100.0 * $update_index_cp / $totalCnt}]]
|
||||
$::main_status update $update_index_cp $totalCnt
|
||||
}
|
||||
|
||||
proc update_index {msg pathList after} {
|
||||
@@ -87,12 +124,7 @@ proc update_index {msg pathList after} {
|
||||
set batch [expr {int($totalCnt * .01) + 1}]
|
||||
if {$batch > 25} {set batch 25}
|
||||
|
||||
ui_status [format \
|
||||
"%s... %i/%i files (%.2f%%)" \
|
||||
$msg \
|
||||
$update_index_cp \
|
||||
$totalCnt \
|
||||
0.0]
|
||||
$::main_status start $msg [mc "files"]
|
||||
set fd [git_write update-index --add --remove -z --stdin]
|
||||
fconfigure $fd \
|
||||
-blocking 0 \
|
||||
@@ -106,19 +138,16 @@ proc update_index {msg pathList after} {
|
||||
$pathList \
|
||||
$totalCnt \
|
||||
$batch \
|
||||
$msg \
|
||||
$after \
|
||||
]
|
||||
}
|
||||
|
||||
proc write_update_index {fd pathList totalCnt batch msg after} {
|
||||
proc write_update_index {fd pathList totalCnt batch after} {
|
||||
global update_index_cp
|
||||
global file_states current_diff_path
|
||||
|
||||
if {$update_index_cp >= $totalCnt} {
|
||||
close $fd
|
||||
unlock_index
|
||||
uplevel #0 $after
|
||||
_close_updateindex $fd $after
|
||||
return
|
||||
}
|
||||
|
||||
@@ -147,12 +176,7 @@ proc write_update_index {fd pathList totalCnt batch msg after} {
|
||||
display_file $path $new
|
||||
}
|
||||
|
||||
ui_status [format \
|
||||
"%s... %i/%i files (%.2f%%)" \
|
||||
$msg \
|
||||
$update_index_cp \
|
||||
$totalCnt \
|
||||
[expr {100.0 * $update_index_cp / $totalCnt}]]
|
||||
$::main_status update $update_index_cp $totalCnt
|
||||
}
|
||||
|
||||
proc checkout_index {msg pathList after} {
|
||||
@@ -166,12 +190,7 @@ proc checkout_index {msg pathList after} {
|
||||
set batch [expr {int($totalCnt * .01) + 1}]
|
||||
if {$batch > 25} {set batch 25}
|
||||
|
||||
ui_status [format \
|
||||
"%s... %i/%i files (%.2f%%)" \
|
||||
$msg \
|
||||
$update_index_cp \
|
||||
$totalCnt \
|
||||
0.0]
|
||||
$::main_status start $msg [mc "files"]
|
||||
set fd [git_write checkout-index \
|
||||
--index \
|
||||
--quiet \
|
||||
@@ -191,19 +210,16 @@ proc checkout_index {msg pathList after} {
|
||||
$pathList \
|
||||
$totalCnt \
|
||||
$batch \
|
||||
$msg \
|
||||
$after \
|
||||
]
|
||||
}
|
||||
|
||||
proc write_checkout_index {fd pathList totalCnt batch msg after} {
|
||||
proc write_checkout_index {fd pathList totalCnt batch after} {
|
||||
global update_index_cp
|
||||
global file_states current_diff_path
|
||||
|
||||
if {$update_index_cp >= $totalCnt} {
|
||||
close $fd
|
||||
unlock_index
|
||||
uplevel #0 $after
|
||||
_close_updateindex $fd $after
|
||||
return
|
||||
}
|
||||
|
||||
@@ -222,12 +238,7 @@ proc write_checkout_index {fd pathList totalCnt batch msg after} {
|
||||
}
|
||||
}
|
||||
|
||||
ui_status [format \
|
||||
"%s... %i/%i files (%.2f%%)" \
|
||||
$msg \
|
||||
$update_index_cp \
|
||||
$totalCnt \
|
||||
[expr {100.0 * $update_index_cp / $totalCnt}]]
|
||||
$::main_status update $update_index_cp $totalCnt
|
||||
}
|
||||
|
||||
proc unstage_helper {txt paths} {
|
||||
@@ -268,7 +279,7 @@ proc do_unstage_selection {} {
|
||||
[array names selected_paths]
|
||||
} elseif {$current_diff_path ne {}} {
|
||||
unstage_helper \
|
||||
"Unstaging [short_path $current_diff_path] from commit" \
|
||||
[mc "Unstaging %s from commit" [short_path $current_diff_path]] \
|
||||
[list $current_diff_path]
|
||||
}
|
||||
}
|
||||
@@ -312,7 +323,7 @@ proc do_add_selection {} {
|
||||
[array names selected_paths]
|
||||
} elseif {$current_diff_path ne {}} {
|
||||
add_helper \
|
||||
"Adding [short_path $current_diff_path]" \
|
||||
[mc "Adding %s" [short_path $current_diff_path]] \
|
||||
[list $current_diff_path]
|
||||
}
|
||||
}
|
||||
@@ -351,26 +362,35 @@ proc revert_helper {txt paths} {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Split question between singular and plural cases, because
|
||||
# such distinction is needed in some languages. Previously, the
|
||||
# code used "Revert changes in" for both, but that can't work
|
||||
# in languages where 'in' must be combined with word from
|
||||
# rest of string (in diffrent way for both cases of course).
|
||||
#
|
||||
# FIXME: Unfortunately, even that isn't enough in some languages
|
||||
# as they have quite complex plural-form rules. Unfortunately,
|
||||
# msgcat doesn't seem to support that kind of string translation.
|
||||
#
|
||||
set n [llength $pathList]
|
||||
if {$n == 0} {
|
||||
unlock_index
|
||||
return
|
||||
} elseif {$n == 1} {
|
||||
set s "[short_path [lindex $pathList]]"
|
||||
set query [mc "Revert changes in file %s?" [short_path [lindex $pathList]]]
|
||||
} else {
|
||||
set s "these $n files"
|
||||
set query [mc "Revert changes in these %i files?" $n]
|
||||
}
|
||||
|
||||
set reply [tk_dialog \
|
||||
.confirm_revert \
|
||||
"[appname] ([reponame])" \
|
||||
"Revert changes in $s?
|
||||
|
||||
Any unstaged changes will be permanently lost by the revert." \
|
||||
[mc "Any unstaged changes will be permanently lost by the revert."] \
|
||||
question \
|
||||
1 \
|
||||
{Do Nothing} \
|
||||
{Revert Changes} \
|
||||
[mc "Do Nothing"] \
|
||||
[mc "Revert Changes"] \
|
||||
]
|
||||
if {$reply == 1} {
|
||||
checkout_index \
|
||||
|
||||
43
git-gui/lib/logo.tcl
Normal file
43
git-gui/lib/logo.tcl
Normal file
@@ -0,0 +1,43 @@
|
||||
# git-gui Git Gui logo
|
||||
# Copyright (C) 2007 Shawn Pearce
|
||||
|
||||
# Henrik Nyh's alternative Git logo, from his blog post
|
||||
# http://henrik.nyh.se/2007/06/alternative-git-logo-and-favicon
|
||||
#
|
||||
image create photo ::git_logo_data -data {
|
||||
R0lGODdhYQC8AIQbAGZmZtg4LW9vb3l5eYKCgoyMjEC/TOJpYZWVlZ+fn2/PeKmpqbKysry8vMXF
|
||||
xZ/fpc/Pz7fnvPXNytnZ2eLi4s/v0vja1+zs7Of36fX19f3z8v///////////////////ywAAAAA
|
||||
YQC8AAAF/uAmjmRpnmiqrmzrvq4hz3RtGw+s7zx5/7dcb0hUAY8zYXHJRCKVzGjPeYRKry8q0Irt
|
||||
GrVBr3gFDo/PprKNix6ra+y2902Ly7H05L2dl9n3UX04gGeCf4RFhohiiotdjY5XkJGBfYeUOpOY
|
||||
iZablXmXURgPpKWmp6ipqYIKqq6vqREjFYK1trUKs7e7vFq5IrS9wsM0vxvBxMm8xsjKzqy6z9J5
|
||||
zNPWatXX2k7Z29433d/iMuHj3+Xm2+jp1+vs0+7vz/HyyvT1xPf4wvr7y9H+pBkbBasgLFYGE8ba
|
||||
o8nTlE4OOYGKKJFOKIopGmLMAnHjDo0eWYAM+WUiSRgj/k+eSKmyBMuWI17C3CATZs2WN1XmPLmT
|
||||
ZM+QPz0G3VihqNGjSJNWwDCzqdOnUKPu0SChqtWrWLNq3cq1q9evYCVYGCEhgNmzaNOqXcu2rdu3
|
||||
cOMGOEBWrt27ePPCpSuirN6/gAO35bvBr+DDiPMSNpy4sWO2ix9Lnmw2MuXLiS1j3gxYM+fPdz2D
|
||||
Hv1WNOnTak2jXj23LuvXlV3DZq16Nujatjnjzo15N2/Kvn9LDi7cMfHimaUqX868ufPn0KPPpOCA
|
||||
AQMWCQBo3869u/fv4MNrd3DlQoMC3QlkSJFdvPv38LVDWJLBAYHwE1LE38+/+/UhGTAggHv5odDf
|
||||
gfv9/seDgPAVeAKCELqnIAwU3BefgyZEqOF3E7rAQH8YlrDhiNt1uEIG6IGoH4kjmpjCBRaqaCCL
|
||||
G7p4AgUDIhgiCTTW2AKOEe44Qo8a2khCBgNoKKQIREZopAgZxAjhkhs0CeGTG7Sn5IpW9vekAyRS
|
||||
2eWBRl6Q44ZijhlfAQlQmeKIaarpHZsMTHABCxDQGKec3JH3QpIs7snndn6yAKaeXA7aZwuABppo
|
||||
fAws0GiEhaKQJ40F3DkjfwVC8CaCAlCgAgIkJjDfCgdiOMGn/Q2w3gkZtPgqC6ma0ECECaBwa4QE
|
||||
aOpCrSYAqeMJpEKYqw7ABnsmfwQ8aCwPySqLYKUb/kwAYbPQyoiCtQcOUMKHBwrgK7LaogBuuaxC
|
||||
OkS0KEwa37EiLBufALPuwO4Jh/InwAixkknEvSe4C9+p3PY3rr3lpnDufguIcCmzRQAc7IHYLhxf
|
||||
w/8mnILA74lg8cARa4xCsZxusMCBomZccgsfv0deuh2HvLKh/sLs3hJSvieuCwUzvIHN4tGXc3ih
|
||||
vtDzmj8fSNLR8BWQdH9LH+g00OFF3d/UBx4cUcvuOc21eFRiouV+Xvvr0dDvlX21R/2uzTR89TqU
|
||||
L3+5UoBgAxtRHd5/CHpLkd13i4D2e3hHRLKMY+9Hr0Nvx/fq3Pw57cng7/m9wQVObnIyhAiQwHF8
|
||||
/tQS8nDgI2wOYeh3CAvhuIBHiDEgqvdtwudkaz3GBPKaTcKuGgqAJRMZmK6h1hnk3ncDcUvhgPFS
|
||||
o5B476ZKQcECzCN4qgmYN4lAncmzcAEEkhJp+QlfkyhAAdtbN8H67FvHQAF6b4g6v9UryqfkKkBu
|
||||
v/0prxD//kR63YnqB8AeqcdoBRxU/1zAuwRaaX4reJ4DSSRAHUhwgrgqwgUx2B94EWGDHISPBzUY
|
||||
QgSNcAn6K6F4fscDCtBOhdoRwPW6kIHDwZA7vWoDBF44Qd/tIUAEBCACbIeG4AXxfmFrQ4B4OCYE
|
||||
JBEQELChmgbAACJioj4JOCKCCLCABZ6EAg1IHwDlyLYAB1gRJhSYgHUQAD9WnQ9+CWBAA+wknTpC
|
||||
JwQAOw==
|
||||
}
|
||||
|
||||
proc git_logo {w} {
|
||||
label $w \
|
||||
-borderwidth 1 \
|
||||
-relief sunken \
|
||||
-background white \
|
||||
-image ::git_logo_data
|
||||
return $w
|
||||
}
|
||||
@@ -10,10 +10,10 @@ method _can_merge {} {
|
||||
global HEAD commit_type file_states
|
||||
|
||||
if {[string match amend* $commit_type]} {
|
||||
info_popup {Cannot merge while amending.
|
||||
info_popup [mc "Cannot merge while amending.
|
||||
|
||||
You must finish amending this commit before starting any type of merge.
|
||||
}
|
||||
"]
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ You must finish amending this commit before starting any type of merge.
|
||||
#
|
||||
repository_state curType curHEAD curMERGE_HEAD
|
||||
if {$commit_type ne $curType || $HEAD ne $curHEAD} {
|
||||
info_popup {Last scanned state does not match repository state.
|
||||
info_popup [mc "Last scanned state does not match repository state.
|
||||
|
||||
Another Git program has modified this repository since the last scan. A rescan must be performed before a merge can be performed.
|
||||
|
||||
The rescan will be automatically started now.
|
||||
}
|
||||
"]
|
||||
unlock_index
|
||||
rescan ui_ready
|
||||
return 0
|
||||
@@ -41,22 +41,22 @@ The rescan will be automatically started now.
|
||||
continue; # and pray it works!
|
||||
}
|
||||
U? {
|
||||
error_popup "You are in the middle of a conflicted merge.
|
||||
error_popup [mc "You are in the middle of a conflicted merge.
|
||||
|
||||
File [short_path $path] has merge conflicts.
|
||||
File %s has merge conflicts.
|
||||
|
||||
You must resolve them, stage the file, and commit to complete the current merge. Only then can you begin another merge.
|
||||
"
|
||||
" [short_path $path]]
|
||||
unlock_index
|
||||
return 0
|
||||
}
|
||||
?? {
|
||||
error_popup "You are in the middle of a change.
|
||||
error_popup [mc "You are in the middle of a change.
|
||||
|
||||
File [short_path $path] is modified.
|
||||
File %s is modified.
|
||||
|
||||
You should complete the current commit before starting a merge. Doing so will help you abort a failed merge, should the need arise.
|
||||
"
|
||||
" [short_path $path]]
|
||||
unlock_index
|
||||
return 0
|
||||
}
|
||||
@@ -103,7 +103,7 @@ method _start {} {
|
||||
regsub {^[^:@]*@} $remote {} remote
|
||||
}
|
||||
set branch [lindex $spec 2]
|
||||
set stitle "$branch of $remote"
|
||||
set stitle [mc "%s of %s" $branch $remote]
|
||||
}
|
||||
regsub ^refs/heads/ $branch {} branch
|
||||
puts $fh "$cmit\t\tbranch '$branch' of $remote"
|
||||
@@ -116,9 +116,9 @@ method _start {} {
|
||||
lappend cmd HEAD
|
||||
lappend cmd $name
|
||||
|
||||
set msg "Merging $current_branch and $stitle"
|
||||
set msg [mc "Merging %s and %s" $current_branch $stitle]
|
||||
ui_status "$msg..."
|
||||
set cons [console::new "Merge" "merge $stitle"]
|
||||
set cons [console::new [mc "Merge"] "merge $stitle"]
|
||||
console::exec $cons $cmd [cb _finish $cons]
|
||||
|
||||
wm protocol $w WM_DELETE_WINDOW {}
|
||||
@@ -128,9 +128,9 @@ method _start {} {
|
||||
method _finish {cons ok} {
|
||||
console::done $cons $ok
|
||||
if {$ok} {
|
||||
set msg {Merge completed successfully.}
|
||||
set msg [mc "Merge completed successfully."]
|
||||
} else {
|
||||
set msg {Merge failed. Conflict resolution is required.}
|
||||
set msg [mc "Merge failed. Conflict resolution is required."]
|
||||
}
|
||||
unlock_index
|
||||
rescan [list ui_status $msg]
|
||||
@@ -147,7 +147,7 @@ constructor dialog {} {
|
||||
}
|
||||
|
||||
make_toplevel top w
|
||||
wm title $top "[appname] ([reponame]): Merge"
|
||||
wm title $top [append "[appname] ([reponame]): " [mc "Merge"]]
|
||||
if {$top ne {.}} {
|
||||
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
|
||||
}
|
||||
@@ -155,26 +155,26 @@ constructor dialog {} {
|
||||
set _start [cb _start]
|
||||
|
||||
label $w.header \
|
||||
-text "Merge Into $current_branch" \
|
||||
-text [mc "Merge Into %s" $current_branch] \
|
||||
-font font_uibold
|
||||
pack $w.header -side top -fill x
|
||||
|
||||
frame $w.buttons
|
||||
button $w.buttons.visualize \
|
||||
-text Visualize \
|
||||
-text [mc Visualize] \
|
||||
-command [cb _visualize]
|
||||
pack $w.buttons.visualize -side left
|
||||
button $w.buttons.merge \
|
||||
-text Merge \
|
||||
-text [mc Merge] \
|
||||
-command $_start
|
||||
pack $w.buttons.merge -side right
|
||||
button $w.buttons.cancel \
|
||||
-text {Cancel} \
|
||||
-text [mc "Cancel"] \
|
||||
-command [cb _cancel]
|
||||
pack $w.buttons.cancel -side right -padx 5
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
set w_rev [::choose_rev::new_unmerged $w.rev {Revision To Merge}]
|
||||
set w_rev [::choose_rev::new_unmerged $w.rev [mc "Revision To Merge"]]
|
||||
pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5
|
||||
|
||||
bind $w <$M1B-Key-Return> $_start
|
||||
@@ -209,34 +209,34 @@ proc reset_hard {} {
|
||||
global HEAD commit_type file_states
|
||||
|
||||
if {[string match amend* $commit_type]} {
|
||||
info_popup {Cannot abort while amending.
|
||||
info_popup [mc "Cannot abort while amending.
|
||||
|
||||
You must finish amending this commit.
|
||||
}
|
||||
"]
|
||||
return
|
||||
}
|
||||
|
||||
if {![lock_index abort]} return
|
||||
|
||||
if {[string match *merge* $commit_type]} {
|
||||
set op_question "Abort merge?
|
||||
set op_question [mc "Abort merge?
|
||||
|
||||
Aborting the current merge will cause *ALL* uncommitted changes to be lost.
|
||||
|
||||
Continue with aborting the current merge?"
|
||||
Continue with aborting the current merge?"]
|
||||
} else {
|
||||
set op_question "Reset changes?
|
||||
set op_question [mc "Reset changes?
|
||||
|
||||
Resetting the changes will cause *ALL* uncommitted changes to be lost.
|
||||
|
||||
Continue with resetting the current changes?"
|
||||
Continue with resetting the current changes?"]
|
||||
}
|
||||
|
||||
if {[ask_popup $op_question] eq {yes}} {
|
||||
set fd [git_read --stderr read-tree --reset -u -v HEAD]
|
||||
fconfigure $fd -blocking 0 -translation binary
|
||||
fileevent $fd readable [namespace code [list _reset_wait $fd]]
|
||||
$::main_status start {Aborting} {files reset}
|
||||
$::main_status start [mc "Aborting"] {files reset}
|
||||
} else {
|
||||
unlock_index
|
||||
}
|
||||
@@ -263,9 +263,9 @@ proc _reset_wait {fd} {
|
||||
catch {file delete [gitdir GITGUI_MSG]}
|
||||
|
||||
if {$fail} {
|
||||
warn_popup "Abort failed.\n\n$err"
|
||||
warn_popup "[mc "Abort failed."]\n\n$err"
|
||||
}
|
||||
rescan {ui_status {Abort completed. Ready.}}
|
||||
rescan {ui_status [mc "Abort completed. Ready."]}
|
||||
} else {
|
||||
fconfigure $fd -blocking 0
|
||||
}
|
||||
|
||||
@@ -54,85 +54,6 @@ proc save_config {} {
|
||||
}
|
||||
}
|
||||
|
||||
proc do_about {} {
|
||||
global appvers copyright oguilib
|
||||
global tcl_patchLevel tk_patchLevel
|
||||
|
||||
set w .about_dialog
|
||||
toplevel $w
|
||||
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
|
||||
|
||||
label $w.header -text "About [appname]" \
|
||||
-font font_uibold
|
||||
pack $w.header -side top -fill x
|
||||
|
||||
frame $w.buttons
|
||||
button $w.buttons.close -text {Close} \
|
||||
-default active \
|
||||
-command [list destroy $w]
|
||||
pack $w.buttons.close -side right
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
label $w.desc \
|
||||
-text "git-gui - a graphical user interface for Git.
|
||||
$copyright" \
|
||||
-padx 5 -pady 5 \
|
||||
-justify left \
|
||||
-anchor w \
|
||||
-borderwidth 1 \
|
||||
-relief solid
|
||||
pack $w.desc -side top -fill x -padx 5 -pady 5
|
||||
|
||||
set v {}
|
||||
append v "git-gui version $appvers\n"
|
||||
append v "[git version]\n"
|
||||
append v "\n"
|
||||
if {$tcl_patchLevel eq $tk_patchLevel} {
|
||||
append v "Tcl/Tk version $tcl_patchLevel"
|
||||
} else {
|
||||
append v "Tcl version $tcl_patchLevel"
|
||||
append v ", Tk version $tk_patchLevel"
|
||||
}
|
||||
|
||||
set d {}
|
||||
append d "git wrapper: $::_git\n"
|
||||
append d "git exec dir: [gitexec]\n"
|
||||
append d "git-gui lib: $oguilib"
|
||||
|
||||
label $w.vers \
|
||||
-text $v \
|
||||
-padx 5 -pady 5 \
|
||||
-justify left \
|
||||
-anchor w \
|
||||
-borderwidth 1 \
|
||||
-relief solid
|
||||
pack $w.vers -side top -fill x -padx 5 -pady 5
|
||||
|
||||
label $w.dirs \
|
||||
-text $d \
|
||||
-padx 5 -pady 5 \
|
||||
-justify left \
|
||||
-anchor w \
|
||||
-borderwidth 1 \
|
||||
-relief solid
|
||||
pack $w.dirs -side top -fill x -padx 5 -pady 5
|
||||
|
||||
menu $w.ctxm -tearoff 0
|
||||
$w.ctxm add command \
|
||||
-label {Copy} \
|
||||
-command "
|
||||
clipboard clear
|
||||
clipboard append -format STRING -type STRING -- \[$w.vers cget -text\]
|
||||
"
|
||||
|
||||
bind $w <Visibility> "grab $w; focus $w.buttons.close"
|
||||
bind $w <Key-Escape> "destroy $w"
|
||||
bind $w <Key-Return> "destroy $w"
|
||||
bind_button3 $w.vers "tk_popup $w.ctxm %X %Y; grab $w; focus $w"
|
||||
wm title $w "About [appname]"
|
||||
tkwait window $w
|
||||
}
|
||||
|
||||
proc do_options {} {
|
||||
global repo_config global_config font_descs
|
||||
global repo_config_new global_config_new
|
||||
@@ -157,48 +78,44 @@ proc do_options {} {
|
||||
toplevel $w
|
||||
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
|
||||
|
||||
label $w.header -text "Options" \
|
||||
-font font_uibold
|
||||
pack $w.header -side top -fill x
|
||||
|
||||
frame $w.buttons
|
||||
button $w.buttons.restore -text {Restore Defaults} \
|
||||
button $w.buttons.restore -text [mc "Restore Defaults"] \
|
||||
-default normal \
|
||||
-command do_restore_defaults
|
||||
pack $w.buttons.restore -side left
|
||||
button $w.buttons.save -text Save \
|
||||
button $w.buttons.save -text [mc Save] \
|
||||
-default active \
|
||||
-command [list do_save_config $w]
|
||||
pack $w.buttons.save -side right
|
||||
button $w.buttons.cancel -text {Cancel} \
|
||||
button $w.buttons.cancel -text [mc "Cancel"] \
|
||||
-default normal \
|
||||
-command [list destroy $w]
|
||||
pack $w.buttons.cancel -side right -padx 5
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
labelframe $w.repo -text "[reponame] Repository"
|
||||
labelframe $w.global -text {Global (All Repositories)}
|
||||
labelframe $w.repo -text [mc "%s Repository" [reponame]]
|
||||
labelframe $w.global -text [mc "Global (All Repositories)"]
|
||||
pack $w.repo -side left -fill both -expand 1 -pady 5 -padx 5
|
||||
pack $w.global -side right -fill both -expand 1 -pady 5 -padx 5
|
||||
|
||||
set optid 0
|
||||
foreach option {
|
||||
{t user.name {User Name}}
|
||||
{t user.email {Email Address}}
|
||||
{t user.name {mc "User Name"}}
|
||||
{t user.email {mc "Email Address"}}
|
||||
|
||||
{b merge.summary {Summarize Merge Commits}}
|
||||
{i-1..5 merge.verbosity {Merge Verbosity}}
|
||||
{b merge.diffstat {Show Diffstat After Merge}}
|
||||
{b merge.summary {mc "Summarize Merge Commits"}}
|
||||
{i-1..5 merge.verbosity {mc "Merge Verbosity"}}
|
||||
{b merge.diffstat {mc "Show Diffstat After Merge"}}
|
||||
|
||||
{b gui.trustmtime {Trust File Modification Timestamps}}
|
||||
{b gui.pruneduringfetch {Prune Tracking Branches During Fetch}}
|
||||
{b gui.matchtrackingbranch {Match Tracking Branches}}
|
||||
{i-0..99 gui.diffcontext {Number of Diff Context Lines}}
|
||||
{t gui.newbranchtemplate {New Branch Name Template}}
|
||||
{b gui.trustmtime {mc "Trust File Modification Timestamps"}}
|
||||
{b gui.pruneduringfetch {mc "Prune Tracking Branches During Fetch"}}
|
||||
{b gui.matchtrackingbranch {mc "Match Tracking Branches"}}
|
||||
{i-0..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
|
||||
{t gui.newbranchtemplate {mc "New Branch Name Template"}}
|
||||
} {
|
||||
set type [lindex $option 0]
|
||||
set name [lindex $option 1]
|
||||
set text [lindex $option 2]
|
||||
set text [eval [lindex $option 2]]
|
||||
incr optid
|
||||
foreach f {repo global} {
|
||||
switch -glob -- $type {
|
||||
@@ -246,7 +163,7 @@ proc do_options {} {
|
||||
foreach option $font_descs {
|
||||
set name [lindex $option 0]
|
||||
set font [lindex $option 1]
|
||||
set text [lindex $option 2]
|
||||
set text [eval [lindex $option 2]]
|
||||
|
||||
set global_config_new(gui.$font^^family) \
|
||||
[font configure $font -family]
|
||||
@@ -278,7 +195,13 @@ proc do_options {} {
|
||||
bind $w <Visibility> "grab $w; focus $w.buttons.save"
|
||||
bind $w <Key-Escape> "destroy $w"
|
||||
bind $w <Key-Return> [list do_save_config $w]
|
||||
wm title $w "[appname] ([reponame]): Options"
|
||||
|
||||
if {[is_MacOSX]} {
|
||||
set t [mc "Preferences"]
|
||||
} else {
|
||||
set t [mc "Options"]
|
||||
}
|
||||
wm title $w "[appname] ([reponame]): $t"
|
||||
tkwait window $w
|
||||
}
|
||||
|
||||
@@ -309,7 +232,7 @@ proc do_restore_defaults {} {
|
||||
|
||||
proc do_save_config {w} {
|
||||
if {[catch {save_config} err]} {
|
||||
error_popup "Failed to completely save options:\n\n$err"
|
||||
error_popup [strcat [mc "Failed to completely save options:"] "\n\n$err"]
|
||||
}
|
||||
reshow_diff
|
||||
destroy $w
|
||||
|
||||
@@ -135,8 +135,10 @@ proc load_all_remotes {} {
|
||||
proc populate_fetch_menu {} {
|
||||
global all_remotes repo_config
|
||||
|
||||
set m .mbar.fetch
|
||||
set prune_list [list]
|
||||
set remote_m .mbar.remote
|
||||
set fetch_m $remote_m.fetch
|
||||
set prune_m $remote_m.prune
|
||||
|
||||
foreach r $all_remotes {
|
||||
set enable 0
|
||||
if {![catch {set a $repo_config(remote.$r.url)}]} {
|
||||
@@ -157,28 +159,34 @@ proc populate_fetch_menu {} {
|
||||
}
|
||||
|
||||
if {$enable} {
|
||||
lappend prune_list $r
|
||||
$m add command \
|
||||
-label "Fetch from $r..." \
|
||||
-command [list fetch_from $r]
|
||||
}
|
||||
}
|
||||
if {![winfo exists $fetch_m]} {
|
||||
menu $prune_m
|
||||
$remote_m insert 0 cascade \
|
||||
-label [mc "Prune from"] \
|
||||
-menu $prune_m
|
||||
|
||||
if {$prune_list ne {}} {
|
||||
$m add separator
|
||||
}
|
||||
foreach r $prune_list {
|
||||
$m add command \
|
||||
-label "Prune from $r..." \
|
||||
-command [list prune_from $r]
|
||||
menu $fetch_m
|
||||
$remote_m insert 0 cascade \
|
||||
-label [mc "Fetch from"] \
|
||||
-menu $fetch_m
|
||||
}
|
||||
|
||||
$fetch_m add command \
|
||||
-label $r \
|
||||
-command [list fetch_from $r]
|
||||
$prune_m add command \
|
||||
-label $r \
|
||||
-command [list prune_from $r]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc populate_push_menu {} {
|
||||
global all_remotes repo_config
|
||||
|
||||
set m .mbar.push
|
||||
set fast_count 0
|
||||
set remote_m .mbar.remote
|
||||
set push_m $remote_m.push
|
||||
|
||||
foreach r $all_remotes {
|
||||
set enable 0
|
||||
if {![catch {set a $repo_config(remote.$r.url)}]} {
|
||||
@@ -199,13 +207,16 @@ proc populate_push_menu {} {
|
||||
}
|
||||
|
||||
if {$enable} {
|
||||
if {!$fast_count} {
|
||||
$m add separator
|
||||
if {![winfo exists $push_m]} {
|
||||
menu $push_m
|
||||
$remote_m insert 0 cascade \
|
||||
-label [mc "Push to"] \
|
||||
-menu $push_m
|
||||
}
|
||||
$m add command \
|
||||
-label "Push to $r..." \
|
||||
|
||||
$push_m add command \
|
||||
-label $r \
|
||||
-command [list push_to $r]
|
||||
incr fast_count
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,28 +26,28 @@ constructor dialog {} {
|
||||
global all_remotes M1B
|
||||
|
||||
make_toplevel top w
|
||||
wm title $top "[appname] ([reponame]): Delete Remote Branch"
|
||||
wm title $top [append "[appname] ([reponame]): " [mc "Delete Remote Branch"]]
|
||||
if {$top ne {.}} {
|
||||
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
|
||||
}
|
||||
|
||||
label $w.header -text {Delete Remote Branch} -font font_uibold
|
||||
label $w.header -text [mc "Delete Remote Branch"] -font font_uibold
|
||||
pack $w.header -side top -fill x
|
||||
|
||||
frame $w.buttons
|
||||
button $w.buttons.delete -text Delete \
|
||||
button $w.buttons.delete -text [mc Delete] \
|
||||
-default active \
|
||||
-command [cb _delete]
|
||||
pack $w.buttons.delete -side right
|
||||
button $w.buttons.cancel -text {Cancel} \
|
||||
button $w.buttons.cancel -text [mc "Cancel"] \
|
||||
-command [list destroy $w]
|
||||
pack $w.buttons.cancel -side right -padx 5
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
labelframe $w.dest -text {From Repository}
|
||||
labelframe $w.dest -text [mc "From Repository"]
|
||||
if {$all_remotes ne {}} {
|
||||
radiobutton $w.dest.remote_r \
|
||||
-text {Remote:} \
|
||||
-text [mc "Remote:"] \
|
||||
-value remote \
|
||||
-variable @urltype
|
||||
eval tk_optionMenu $w.dest.remote_m @remote $all_remotes
|
||||
@@ -63,7 +63,7 @@ constructor dialog {} {
|
||||
set urltype url
|
||||
}
|
||||
radiobutton $w.dest.url_r \
|
||||
-text {Arbitrary URL:} \
|
||||
-text [mc "Arbitrary URL:"] \
|
||||
-value url \
|
||||
-variable @urltype
|
||||
entry $w.dest.url_t \
|
||||
@@ -81,7 +81,7 @@ constructor dialog {} {
|
||||
grid columnconfigure $w.dest 1 -weight 1
|
||||
pack $w.dest -anchor nw -fill x -pady 5 -padx 5
|
||||
|
||||
labelframe $w.heads -text {Branches}
|
||||
labelframe $w.heads -text [mc "Branches"]
|
||||
listbox $w.heads.l \
|
||||
-height 10 \
|
||||
-width 70 \
|
||||
@@ -96,7 +96,7 @@ constructor dialog {} {
|
||||
-anchor w \
|
||||
-justify left
|
||||
button $w.heads.footer.rescan \
|
||||
-text {Rescan} \
|
||||
-text [mc "Rescan"] \
|
||||
-command [cb _rescan]
|
||||
pack $w.heads.footer.status -side left -fill x
|
||||
pack $w.heads.footer.rescan -side right
|
||||
@@ -106,9 +106,9 @@ constructor dialog {} {
|
||||
pack $w.heads.l -side left -fill both -expand 1
|
||||
pack $w.heads -fill both -expand 1 -pady 5 -padx 5
|
||||
|
||||
labelframe $w.validate -text {Delete Only If}
|
||||
labelframe $w.validate -text [mc "Delete Only If"]
|
||||
radiobutton $w.validate.head_r \
|
||||
-text {Merged Into:} \
|
||||
-text [mc "Merged Into:"] \
|
||||
-value head \
|
||||
-variable @checktype
|
||||
set head_m [tk_optionMenu $w.validate.head_m @check_head {}]
|
||||
@@ -116,7 +116,7 @@ constructor dialog {} {
|
||||
trace add variable @check_head write [cb _write_check_head]
|
||||
grid $w.validate.head_r $w.validate.head_m -sticky w
|
||||
radiobutton $w.validate.always_r \
|
||||
-text {Always (Do not perform merge checks)} \
|
||||
-text [mc "Always (Do not perform merge checks)"] \
|
||||
-value always \
|
||||
-variable @checktype
|
||||
grid $w.validate.always_r -columnspan 2 -sticky w
|
||||
@@ -149,7 +149,7 @@ method _delete {} {
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message "A branch is required for 'Merged Into'."
|
||||
-message [mc "A branch is required for 'Merged Into'."]
|
||||
return
|
||||
}
|
||||
set crev $full_cache("$cache\nrefs/heads/$check_head")
|
||||
@@ -181,14 +181,12 @@ method _delete {} {
|
||||
}
|
||||
|
||||
if {$not_merged ne {}} {
|
||||
set msg "The following branches are not completely merged into $check_head:
|
||||
set msg [mc "The following branches are not completely merged into %s:
|
||||
|
||||
- [join $not_merged "\n - "]"
|
||||
- %s" $check_head [join $not_merged "\n - "]]
|
||||
|
||||
if {$need_fetch} {
|
||||
append msg "
|
||||
|
||||
One or more of the merge tests failed because you have not fetched the necessary commits. Try fetching from $uri first."
|
||||
append msg "\n\n" [mc "One or more of the merge tests failed because you have not fetched the necessary commits. Try fetching from %s first." $uri]
|
||||
}
|
||||
|
||||
tk_messageBox \
|
||||
@@ -206,7 +204,7 @@ One or more of the merge tests failed because you have not fetched the necessary
|
||||
-type ok \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message "Please select one or more branches to delete."
|
||||
-message [mc "Please select one or more branches to delete."]
|
||||
return
|
||||
}
|
||||
|
||||
@@ -215,9 +213,9 @@ One or more of the merge tests failed because you have not fetched the necessary
|
||||
-type yesno \
|
||||
-title [wm title $w] \
|
||||
-parent $w \
|
||||
-message {Recovering deleted branches is difficult.
|
||||
-message [mc "Recovering deleted branches is difficult.
|
||||
|
||||
Delete the selected branches?}] ne yes} {
|
||||
Delete the selected branches?"]] ne yes} {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -225,7 +223,7 @@ Delete the selected branches?}] ne yes} {
|
||||
|
||||
set cons [console::new \
|
||||
"push $uri" \
|
||||
"Deleting branches from $uri"]
|
||||
[mc "Deleting branches from %s" $uri]]
|
||||
console::exec $cons $push_cmd
|
||||
}
|
||||
|
||||
@@ -285,12 +283,12 @@ method _load {cache uri} {
|
||||
$w.heads.l conf -state disabled
|
||||
set head_list [list]
|
||||
set full_list [list]
|
||||
set status {No repository selected.}
|
||||
set status [mc "No repository selected."]
|
||||
return
|
||||
}
|
||||
|
||||
if {[catch {set x $cached($cache)}]} {
|
||||
set status "Scanning $uri..."
|
||||
set status [mc "Scanning %s..." $uri]
|
||||
$w.heads.l conf -state disabled
|
||||
set head_list [list]
|
||||
set full_list [list]
|
||||
|
||||
@@ -2,28 +2,22 @@
|
||||
# Copyright (C) 2006, 2007 Shawn Pearce
|
||||
|
||||
proc do_windows_shortcut {} {
|
||||
global argv0
|
||||
|
||||
set fn [tk_getSaveFile \
|
||||
-parent . \
|
||||
-title "[appname] ([reponame]): Create Desktop Icon" \
|
||||
-initialfile "Git [reponame].bat"]
|
||||
-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
|
||||
-initialfile "Git [reponame].lnk"]
|
||||
if {$fn != {}} {
|
||||
if {[file extension $fn] ne {.bat}} {
|
||||
set fn ${fn}.bat
|
||||
if {[file extension $fn] ne {.lnk}} {
|
||||
set fn ${fn}.lnk
|
||||
}
|
||||
if {[catch {
|
||||
set ge [file normalize [file dirname $::_git]]
|
||||
set fd [open $fn w]
|
||||
puts $fd "@ECHO Entering [reponame]"
|
||||
puts $fd "@ECHO Starting git-gui... please wait..."
|
||||
puts $fd "@SET PATH=$ge;%PATH%"
|
||||
puts $fd "@SET GIT_DIR=[file normalize [gitdir]]"
|
||||
puts -nonewline $fd "@\"[info nameofexecutable]\""
|
||||
puts $fd " \"[file normalize $argv0]\""
|
||||
close $fd
|
||||
win32_create_lnk $fn [list \
|
||||
[info nameofexecutable] \
|
||||
[file normalize $::argv0] \
|
||||
] \
|
||||
[file dirname [file normalize [gitdir]]]
|
||||
} err]} {
|
||||
error_popup "Cannot write script:\n\n$err"
|
||||
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,15 +36,14 @@ proc do_cygwin_shortcut {} {
|
||||
}
|
||||
set fn [tk_getSaveFile \
|
||||
-parent . \
|
||||
-title "[appname] ([reponame]): Create Desktop Icon" \
|
||||
-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
|
||||
-initialdir $desktop \
|
||||
-initialfile "Git [reponame].bat"]
|
||||
-initialfile "Git [reponame].lnk"]
|
||||
if {$fn != {}} {
|
||||
if {[file extension $fn] ne {.bat}} {
|
||||
set fn ${fn}.bat
|
||||
if {[file extension $fn] ne {.lnk}} {
|
||||
set fn ${fn}.lnk
|
||||
}
|
||||
if {[catch {
|
||||
set fd [open $fn w]
|
||||
set sh [exec cygpath \
|
||||
--windows \
|
||||
--absolute \
|
||||
@@ -59,19 +52,13 @@ proc do_cygwin_shortcut {} {
|
||||
--unix \
|
||||
--absolute \
|
||||
$argv0]
|
||||
set gd [exec cygpath \
|
||||
--unix \
|
||||
--absolute \
|
||||
[gitdir]]
|
||||
puts $fd "@ECHO Entering [reponame]"
|
||||
puts $fd "@ECHO Starting git-gui... please wait..."
|
||||
puts -nonewline $fd "@\"$sh\" --login -c \""
|
||||
puts -nonewline $fd "GIT_DIR=[sq $gd]"
|
||||
puts -nonewline $fd " [sq $me]"
|
||||
puts $fd " &\""
|
||||
close $fd
|
||||
win32_create_lnk $fn [list \
|
||||
$sh -c \
|
||||
"CHERE_INVOKING=1 source /etc/profile;[sq $me]" \
|
||||
] \
|
||||
[file dirname [file normalize [gitdir]]]
|
||||
} err]} {
|
||||
error_popup "Cannot write script:\n\n$err"
|
||||
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,7 +68,7 @@ proc do_macosx_app {} {
|
||||
|
||||
set fn [tk_getSaveFile \
|
||||
-parent . \
|
||||
-title "[appname] ([reponame]): Create Desktop Icon" \
|
||||
-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
|
||||
-initialdir [file join $env(HOME) Desktop] \
|
||||
-initialfile "Git [reponame].app"]
|
||||
if {$fn != {}} {
|
||||
@@ -146,7 +133,7 @@ proc do_macosx_app {} {
|
||||
|
||||
file attributes $exe -permissions u+x,g+x,o+x
|
||||
} err]} {
|
||||
error_popup "Cannot write icon:\n\n$err"
|
||||
error_popup [strcat [mc "Cannot write icon:"] "\n\n$err"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ class status_bar {
|
||||
field w ; # our own window path
|
||||
field w_l ; # text widget we draw messages into
|
||||
field w_c ; # canvas we draw a progress bar into
|
||||
field c_pack ; # script to pack the canvas with
|
||||
field status {}; # single line of text we show
|
||||
field prefix {}; # text we format into status
|
||||
field units {}; # unit of progress
|
||||
@@ -24,6 +25,29 @@ constructor new {path} {
|
||||
-anchor w \
|
||||
-justify left
|
||||
pack $w_l -side left
|
||||
set c_pack [cb _oneline_pack]
|
||||
|
||||
bind $w <Destroy> [cb _delete %W]
|
||||
return $this
|
||||
}
|
||||
|
||||
method _oneline_pack {} {
|
||||
$w_c conf -width 100
|
||||
pack $w_c -side right
|
||||
}
|
||||
|
||||
constructor two_line {path} {
|
||||
set w $path
|
||||
set w_l $w.l
|
||||
set w_c $w.c
|
||||
|
||||
frame $w
|
||||
label $w_l \
|
||||
-textvariable @status \
|
||||
-anchor w \
|
||||
-justify left
|
||||
pack $w_l -anchor w -fill x
|
||||
set c_pack [list pack $w_c -fill x]
|
||||
|
||||
bind $w <Destroy> [cb _delete %W]
|
||||
return $this
|
||||
@@ -34,13 +58,12 @@ method start {msg uds} {
|
||||
$w_c coords bar 0 0 0 20
|
||||
} else {
|
||||
canvas $w_c \
|
||||
-width 100 \
|
||||
-height [expr {int([winfo reqheight $w_l] * 0.6)}] \
|
||||
-borderwidth 1 \
|
||||
-relief groove \
|
||||
-highlightt 0
|
||||
$w_c create rectangle 0 0 0 20 -tags bar -fill navy
|
||||
pack $w_c -side right
|
||||
eval $c_pack
|
||||
}
|
||||
|
||||
set status $msg
|
||||
@@ -53,11 +76,16 @@ method update {have total} {
|
||||
set pdone 0
|
||||
if {$total > 0} {
|
||||
set pdone [expr {100 * $have / $total}]
|
||||
set cdone [expr {[winfo width $w_c] * $have / $total}]
|
||||
}
|
||||
|
||||
set status [format "%s ... %i of %i %s (%2i%%)" \
|
||||
$prefix $have $total $units $pdone]
|
||||
$w_c coords bar 0 0 $pdone 20
|
||||
set prec [string length [format %i $total]]
|
||||
set status [mc "%s ... %*i of %*i %s (%3i%%)" \
|
||||
$prefix \
|
||||
$prec $have \
|
||||
$prec $total \
|
||||
$units $pdone]
|
||||
$w_c coords bar 0 0 $cdone 20
|
||||
}
|
||||
|
||||
method update_meter {buf} {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
proc fetch_from {remote} {
|
||||
set w [console::new \
|
||||
"fetch $remote" \
|
||||
"Fetching new changes from $remote"]
|
||||
[mc "fetch %s" $remote] \
|
||||
[mc "Fetching new changes from %s" $remote]]
|
||||
set cmds [list]
|
||||
lappend cmds [list exec git fetch $remote]
|
||||
if {[is_config_true gui.pruneduringfetch]} {
|
||||
@@ -15,15 +15,15 @@ proc fetch_from {remote} {
|
||||
|
||||
proc prune_from {remote} {
|
||||
set w [console::new \
|
||||
"remote prune $remote" \
|
||||
"Pruning tracking branches deleted from $remote"]
|
||||
[mc "remote prune %s" $remote] \
|
||||
[mc "Pruning tracking branches deleted from %s" $remote]]
|
||||
console::exec $w [list git remote prune $remote]
|
||||
}
|
||||
|
||||
proc push_to {remote} {
|
||||
set w [console::new \
|
||||
"push $remote" \
|
||||
"Pushing changes to $remote"]
|
||||
[mc "push %s" $remote] \
|
||||
[mc "Pushing changes to %s" $remote]]
|
||||
set cmd [list git push]
|
||||
lappend cmd -v
|
||||
lappend cmd $remote
|
||||
@@ -32,6 +32,7 @@ proc push_to {remote} {
|
||||
|
||||
proc start_push_anywhere_action {w} {
|
||||
global push_urltype push_remote push_url push_thin push_tags
|
||||
global push_force
|
||||
|
||||
set r_url {}
|
||||
switch -- $push_urltype {
|
||||
@@ -45,6 +46,9 @@ proc start_push_anywhere_action {w} {
|
||||
if {$push_thin} {
|
||||
lappend cmd --thin
|
||||
}
|
||||
if {$push_force} {
|
||||
lappend cmd --force
|
||||
}
|
||||
if {$push_tags} {
|
||||
lappend cmd --tags
|
||||
}
|
||||
@@ -64,8 +68,8 @@ proc start_push_anywhere_action {w} {
|
||||
}
|
||||
|
||||
set cons [console::new \
|
||||
"push $r_url" \
|
||||
"Pushing $cnt $unit to $r_url"]
|
||||
[mc "push %s" $r_url] \
|
||||
[mc "Pushing %s %s to %s" $cnt $unit $r_url]]
|
||||
console::exec $cons $cmd
|
||||
destroy $w
|
||||
}
|
||||
@@ -76,26 +80,27 @@ trace add variable push_remote write \
|
||||
proc do_push_anywhere {} {
|
||||
global all_remotes current_branch
|
||||
global push_urltype push_remote push_url push_thin push_tags
|
||||
global push_force
|
||||
|
||||
set w .push_setup
|
||||
toplevel $w
|
||||
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
|
||||
|
||||
label $w.header -text {Push Branches} -font font_uibold
|
||||
label $w.header -text [mc "Push Branches"] -font font_uibold
|
||||
pack $w.header -side top -fill x
|
||||
|
||||
frame $w.buttons
|
||||
button $w.buttons.create -text Push \
|
||||
button $w.buttons.create -text [mc Push] \
|
||||
-default active \
|
||||
-command [list start_push_anywhere_action $w]
|
||||
pack $w.buttons.create -side right
|
||||
button $w.buttons.cancel -text {Cancel} \
|
||||
button $w.buttons.cancel -text [mc "Cancel"] \
|
||||
-default normal \
|
||||
-command [list destroy $w]
|
||||
pack $w.buttons.cancel -side right -padx 5
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
labelframe $w.source -text {Source Branches}
|
||||
labelframe $w.source -text [mc "Source Branches"]
|
||||
listbox $w.source.l \
|
||||
-height 10 \
|
||||
-width 70 \
|
||||
@@ -112,10 +117,10 @@ proc do_push_anywhere {} {
|
||||
pack $w.source.l -side left -fill both -expand 1
|
||||
pack $w.source -fill both -expand 1 -pady 5 -padx 5
|
||||
|
||||
labelframe $w.dest -text {Destination Repository}
|
||||
labelframe $w.dest -text [mc "Destination Repository"]
|
||||
if {$all_remotes ne {}} {
|
||||
radiobutton $w.dest.remote_r \
|
||||
-text {Remote:} \
|
||||
-text [mc "Remote:"] \
|
||||
-value remote \
|
||||
-variable push_urltype
|
||||
eval tk_optionMenu $w.dest.remote_m push_remote $all_remotes
|
||||
@@ -130,7 +135,7 @@ proc do_push_anywhere {} {
|
||||
set push_urltype url
|
||||
}
|
||||
radiobutton $w.dest.url_r \
|
||||
-text {Arbitrary URL:} \
|
||||
-text [mc "Arbitrary URL:"] \
|
||||
-value url \
|
||||
-variable push_urltype
|
||||
entry $w.dest.url_t \
|
||||
@@ -150,25 +155,30 @@ proc do_push_anywhere {} {
|
||||
grid columnconfigure $w.dest 1 -weight 1
|
||||
pack $w.dest -anchor nw -fill x -pady 5 -padx 5
|
||||
|
||||
labelframe $w.options -text {Transfer Options}
|
||||
labelframe $w.options -text [mc "Transfer Options"]
|
||||
checkbutton $w.options.force \
|
||||
-text [mc "Force overwrite existing branch (may discard changes)"] \
|
||||
-variable push_force
|
||||
grid $w.options.force -columnspan 2 -sticky w
|
||||
checkbutton $w.options.thin \
|
||||
-text {Use thin pack (for slow network connections)} \
|
||||
-text [mc "Use thin pack (for slow network connections)"] \
|
||||
-variable push_thin
|
||||
grid $w.options.thin -columnspan 2 -sticky w
|
||||
checkbutton $w.options.tags \
|
||||
-text {Include tags} \
|
||||
-text [mc "Include tags"] \
|
||||
-variable push_tags
|
||||
grid $w.options.tags -columnspan 2 -sticky w
|
||||
grid columnconfigure $w.options 1 -weight 1
|
||||
pack $w.options -anchor nw -fill x -pady 5 -padx 5
|
||||
|
||||
set push_url {}
|
||||
set push_force 0
|
||||
set push_thin 0
|
||||
set push_tags 0
|
||||
|
||||
bind $w <Visibility> "grab $w; focus $w.buttons.create"
|
||||
bind $w <Key-Escape> "destroy $w"
|
||||
bind $w <Key-Return> [list start_push_anywhere_action $w]
|
||||
wm title $w "[appname] ([reponame]): Push"
|
||||
wm title $w [append "[appname] ([reponame]): " [mc "Push"]]
|
||||
tkwait window $w
|
||||
}
|
||||
|
||||
26
git-gui/lib/win32.tcl
Normal file
26
git-gui/lib/win32.tcl
Normal file
@@ -0,0 +1,26 @@
|
||||
# git-gui Misc. native Windows 32 support
|
||||
# Copyright (C) 2007 Shawn Pearce
|
||||
|
||||
proc win32_read_lnk {lnk_path} {
|
||||
return [exec cscript.exe \
|
||||
/E:jscript \
|
||||
/nologo \
|
||||
[file join $::oguilib win32_shortcut.js] \
|
||||
$lnk_path]
|
||||
}
|
||||
|
||||
proc win32_create_lnk {lnk_path lnk_exec lnk_dir} {
|
||||
global oguilib
|
||||
|
||||
set lnk_args [lrange $lnk_exec 1 end]
|
||||
set lnk_exec [lindex $lnk_exec 0]
|
||||
|
||||
eval [list exec wscript.exe \
|
||||
/E:jscript \
|
||||
/nologo \
|
||||
[file join $oguilib win32_shortcut.js] \
|
||||
$lnk_path \
|
||||
[file join $oguilib git-gui.ico] \
|
||||
$lnk_dir \
|
||||
$lnk_exec] $lnk_args
|
||||
}
|
||||
34
git-gui/lib/win32_shortcut.js
Normal file
34
git-gui/lib/win32_shortcut.js
Normal file
@@ -0,0 +1,34 @@
|
||||
// git-gui Windows shortcut support
|
||||
// Copyright (C) 2007 Shawn Pearce
|
||||
|
||||
var WshShell = WScript.CreateObject("WScript.Shell");
|
||||
var argv = WScript.Arguments;
|
||||
var argi = 0;
|
||||
var lnk_path = argv.item(argi++);
|
||||
var ico_path = argi < argv.length ? argv.item(argi++) : undefined;
|
||||
var dir_path = argi < argv.length ? argv.item(argi++) : undefined;
|
||||
var lnk_exec = argi < argv.length ? argv.item(argi++) : undefined;
|
||||
var lnk_args = '';
|
||||
while (argi < argv.length) {
|
||||
var s = argv.item(argi++);
|
||||
if (lnk_args != '')
|
||||
lnk_args += ' ';
|
||||
if (s.indexOf(' ') >= 0) {
|
||||
lnk_args += '"';
|
||||
lnk_args += s;
|
||||
lnk_args += '"';
|
||||
} else {
|
||||
lnk_args += s;
|
||||
}
|
||||
}
|
||||
|
||||
var lnk = WshShell.CreateShortcut(lnk_path);
|
||||
if (argv.length == 1) {
|
||||
WScript.echo(lnk.TargetPath);
|
||||
} else {
|
||||
lnk.TargetPath = lnk_exec;
|
||||
lnk.Arguments = lnk_args;
|
||||
lnk.IconLocation = ico_path + ", 0";
|
||||
lnk.WorkingDirectory = dir_path;
|
||||
lnk.Save();
|
||||
}
|
||||
22
git-gui/macosx/AppMain.tcl
Normal file
22
git-gui/macosx/AppMain.tcl
Normal file
@@ -0,0 +1,22 @@
|
||||
set gitexecdir {@@gitexecdir@@}
|
||||
set gitguilib {@@GITGUI_LIBDIR@@}
|
||||
set env(PATH) "$gitexecdir:$env(PATH)"
|
||||
|
||||
if {[string first -psn [lindex $argv 0]] == 0} {
|
||||
lset argv 0 [file join $gitexecdir git-gui]
|
||||
}
|
||||
|
||||
if {[file tail [lindex $argv 0]] eq {gitk}} {
|
||||
set argv0 [file join $gitexecdir gitk]
|
||||
set AppMain_source $argv0
|
||||
} else {
|
||||
set argv0 [file join $gitexecdir [file tail [lindex $argv 0]]]
|
||||
set AppMain_source [file join $gitguilib git-gui.tcl]
|
||||
if {[pwd] eq {/}} {
|
||||
cd $env(HOME)
|
||||
}
|
||||
}
|
||||
|
||||
unset gitexecdir gitguilib
|
||||
set argv [lrange $argv 1 end]
|
||||
source $AppMain_source
|
||||
28
git-gui/macosx/Info.plist
Normal file
28
git-gui/macosx/Info.plist
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Wish</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Git Gui @@GITGUI_VERSION@@ © 2006-2007 Shawn Pearce, et. al.</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>git-gui.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>cz.or.repo.git-gui</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Git Gui</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@@GITGUI_VERSION@@</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>GITg</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@@GITGUI_VERSION@@</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
git-gui/macosx/git-gui.icns
Normal file
BIN
git-gui/macosx/git-gui.icns
Normal file
Binary file not shown.
2
git-gui/po/.gitignore
vendored
Normal file
2
git-gui/po/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.msg
|
||||
*~
|
||||
209
git-gui/po/README
Normal file
209
git-gui/po/README
Normal file
@@ -0,0 +1,209 @@
|
||||
Localizing git-gui for your language
|
||||
====================================
|
||||
|
||||
This short note is to help you, who reads and writes English and your
|
||||
own language, help us getting git-gui localized for more languages. It
|
||||
does not try to be a comprehensive manual of GNU gettext, which is the
|
||||
i18n framework we use, but tries to help you get started by covering the
|
||||
basics and how it is used in this project.
|
||||
|
||||
1. Getting started.
|
||||
|
||||
You would first need to have a working "git". Your distribution may
|
||||
have it as "git-core" package (do not get "GNU Interactive Tools" --
|
||||
that is a different "git"). You would also need GNU gettext toolchain
|
||||
to test the resulting translation out. Although you can work on message
|
||||
translation files with a regular text editor, it is a good idea to have
|
||||
specialized so-called "po file editors" (e.g. emacs po-mode, KBabel,
|
||||
poedit, GTranslator --- any of them would work well). Please install
|
||||
them.
|
||||
|
||||
You would then need to clone the git-gui internationalization project
|
||||
repository, so that you can work on it:
|
||||
|
||||
$ git clone mob@repo.or.cz:/srv/git/git-gui/git-gui-i18n.git/
|
||||
$ cd git-gui-i18n
|
||||
$ git checkout --track -b mob origin/mob
|
||||
$ git config remote.origin.push mob
|
||||
|
||||
The "git checkout" command creates a 'mob' branch from upstream's
|
||||
corresponding branch and makes it your current branch. You will be
|
||||
working on this branch.
|
||||
|
||||
The "git config" command records in your repository configuration file
|
||||
that you would push "mob" branch to the upstream when you say "git
|
||||
push".
|
||||
|
||||
|
||||
2. Starting a new language.
|
||||
|
||||
In the git-gui-i18n directory is a po/ subdirectory. It has a
|
||||
handful files whose names end with ".po". Is there a file that has
|
||||
messages in your language?
|
||||
|
||||
If you do not know what your language should be named, you need to find
|
||||
it. This currently follows ISO 639-1 two letter codes:
|
||||
|
||||
http://www.loc.gov/standards/iso639-2/php/code_list.php
|
||||
|
||||
For example, if you are preparing a translation for Afrikaans, the
|
||||
language code is "af". If there already is a translation for your
|
||||
language, you do not have to perform any step in this section, but keep
|
||||
reading, because we are covering the basics.
|
||||
|
||||
If you did not find your language, you would need to start one yourself.
|
||||
Copy po/git-gui.pot file to po/af.po (replace "af" with the code for
|
||||
your language). Edit the first several lines to match existing *.po
|
||||
files to make it clear this is a translation table for git-gui project,
|
||||
and you are the primary translator. The result of your editing would
|
||||
look something like this:
|
||||
|
||||
# Translation of git-gui to Afrikaans
|
||||
# Copyright (C) 2007 Shawn Pearce
|
||||
# This file is distributed under the same license as the git-gui package.
|
||||
# YOUR NAME <YOUR@E-MAIL.ADDRESS>, 2007.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: git-gui\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2007-07-24 22:19+0300\n"
|
||||
"PO-Revision-Date: 2007-07-25 18:00+0900\n"
|
||||
"Last-Translator: YOUR NAME <YOUR@E-MAIL.ADDRESS>\n"
|
||||
"Language-Team: Afrikaans\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
You will find many pairs of a "msgid" line followed by a "msgstr" line.
|
||||
These pairs define how messages in git-gui application are translated to
|
||||
your language. Your primarily job is to fill in the empty double quote
|
||||
pairs on msgstr lines with the translation of the strings on their
|
||||
matching msgid lines. A few tips:
|
||||
|
||||
- Control characters, such as newlines, are written in backslash
|
||||
sequence similar to string literals in the C programming language.
|
||||
When the string given on a msgid line has such a backslash sequence,
|
||||
you would typically want to have corresponding ones in the string on
|
||||
your msgstr line.
|
||||
|
||||
- Some messages contain an optional context indicator at the end,
|
||||
for example "@@noun" or "@@verb". This indicator allows the
|
||||
software to select the correct translation depending upon the use.
|
||||
The indicator is not actually part of the message and will not
|
||||
be shown to the end-user.
|
||||
|
||||
If your language does not require a different translation you
|
||||
will still need to translate both messages.
|
||||
|
||||
- Often the messages being translated are format strings given to
|
||||
"printf()"-like functions. Make sure "%s", "%d", and "%%" in your
|
||||
translated messages match the original.
|
||||
|
||||
When you have to change the order of words, you can add "<number>\$"
|
||||
between '%' and the conversion ('s', 'd', etc.) to say "<number>-th
|
||||
parameter to the format string is used at this point". For example,
|
||||
if the original message is like this:
|
||||
|
||||
"Length is %d, Weight is %d"
|
||||
|
||||
and if for whatever reason your translation needs to say weight first
|
||||
and then length, you can say something like:
|
||||
|
||||
"WEIGHT IS %2\$d, LENGTH IS %1\$d"
|
||||
|
||||
The reason you need a backslash before dollar sign is because
|
||||
this is a double quoted string in Tcl language, and without
|
||||
it the letter introduces a variable interpolation, which you
|
||||
do not want here.
|
||||
|
||||
- A long message can be split across multiple lines by ending the
|
||||
string with a double quote, and starting another string on the next
|
||||
line with another double quote. They will be concatenated in the
|
||||
result. For example:
|
||||
|
||||
#: lib/remote_branch_delete.tcl:189
|
||||
#, tcl-format
|
||||
msgid ""
|
||||
"One or more of the merge tests failed because you have not fetched the "
|
||||
"necessary commits. Try fetching from %s first."
|
||||
msgstr ""
|
||||
"HERE YOU WILL WRITE YOUR TRANSLATION OF THE ABOVE LONG "
|
||||
"MESSAGE IN YOUR LANGUAGE."
|
||||
|
||||
You can test your translation by running "make install", which would
|
||||
create po/af.msg file and installs the result, and then running the
|
||||
resulting git-gui under your locale:
|
||||
|
||||
$ make install
|
||||
$ LANG=af git-gui
|
||||
|
||||
There is a trick to test your translation without first installing:
|
||||
|
||||
$ make
|
||||
$ LANG=af ./git-gui.sh
|
||||
|
||||
When you are satisfied with your translation, commit your changes, and
|
||||
push it back to the 'mob' branch:
|
||||
|
||||
$ edit po/af.po
|
||||
... be sure to update Last-Translator: and
|
||||
... PO-Revision-Date: lines.
|
||||
$ git add po/af.po
|
||||
$ git commit -m 'Started Afrikaans translation.'
|
||||
$ git push
|
||||
|
||||
|
||||
3. Updating your translation.
|
||||
|
||||
There may already be a translation for your language, and you may want
|
||||
to contribute an update. This may be because you would want to improve
|
||||
the translation of existing messages, or because the git-gui software
|
||||
itself was updated and there are new messages that need translation.
|
||||
|
||||
In any case, make sure you are up-to-date before starting your work:
|
||||
|
||||
$ git pull
|
||||
|
||||
In the former case, you will edit po/af.po (again, replace "af" with
|
||||
your language code), and after testing and updating the Last-Translator:
|
||||
and PO-Revision-Date: lines, "add/commit/push" as in the previous
|
||||
section.
|
||||
|
||||
By comparing "POT-Creation-Date:" line in po/git-gui.pot file and
|
||||
po/af.po file, you can tell if there are new messages that need to be
|
||||
translated. You would need the GNU gettext package to perform this
|
||||
step.
|
||||
|
||||
$ msgmerge -U po/af.po po/git-gui.pot
|
||||
|
||||
[NEEDSWORK: who is responsible for updating po/git-gui.pot file by
|
||||
running xgettext? IIRC, Christian recommended against running it
|
||||
nilly-willy because it can become a source of unnecessary merge
|
||||
conflicts. Perhaps we should mention something like "
|
||||
|
||||
The po/git-gui.pot file is updated by the internationalization
|
||||
coordinator from time to time. You _could_ update it yourself, but
|
||||
translators are discouraged from doing so because we would want all
|
||||
language teams to be working off of the same version of git-gui.pot.
|
||||
|
||||
" here?]
|
||||
|
||||
This updates po/af.po (again, replace "af" with your language
|
||||
code) so that it contains msgid lines (i.e. the original) that
|
||||
your translation did not have before. There are a few things to
|
||||
watch out for:
|
||||
|
||||
- The original text in English of an older message you already
|
||||
translated might have been changed. You will notice a comment line
|
||||
that begins with "#, fuzzy" in front of such a message. msgmerge
|
||||
tool made its best effort to match your old translation with the
|
||||
message from the updated software, but you may find cases that it
|
||||
matched your old translated message to a new msgid and the pairing
|
||||
does not make any sense -- you would need to fix them, and then
|
||||
remove the "#, fuzzy" line from the message (your fixed translation
|
||||
of the message will not be used before you remove the marker).
|
||||
|
||||
- New messages added to the software will have msgstr lines with empty
|
||||
strings. You would need to translate them.
|
||||
1878
git-gui/po/de.po
Normal file
1878
git-gui/po/de.po
Normal file
File diff suppressed because it is too large
Load Diff
1704
git-gui/po/git-gui.pot
Normal file
1704
git-gui/po/git-gui.pot
Normal file
File diff suppressed because it is too large
Load Diff
9
git-gui/po/glossary/Makefile
Normal file
9
git-gui/po/glossary/Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
PO_TEMPLATE = git-gui-glossary.pot
|
||||
|
||||
ALL_POFILES = $(wildcard *.po)
|
||||
|
||||
$(PO_TEMPLATE): $(subst .pot,.txt,$(PO_TEMPLATE))
|
||||
./txt-to-pot.sh $< > $@
|
||||
|
||||
update-po:: git-gui-glossary.pot
|
||||
$(foreach p, $(ALL_POFILES), echo Updating $p ; msgmerge -U $p $(PO_TEMPLATE) ; )
|
||||
185
git-gui/po/glossary/de.po
Normal file
185
git-gui/po/glossary/de.po
Normal file
@@ -0,0 +1,185 @@
|
||||
# Translation of git-gui glossary to German
|
||||
# Copyright (C) 2007 Shawn Pearce, et al.
|
||||
# This file is distributed under the same license as the git package.
|
||||
# Christian Stimming <stimming@tuhh.de>, 2007
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: git-gui glossary\n"
|
||||
"POT-Creation-Date: 2007-10-19 21:43+0200\n"
|
||||
"PO-Revision-Date: 2007-10-20 15:24+0200\n"
|
||||
"Last-Translator: Christian Stimming <stimming@tuhh.de>\n"
|
||||
"Language-Team: German \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. "English Definition (Dear translator: This file will never be visible to the user! It should only serve as a tool for you, the translator. Nothing more.)"
|
||||
msgid ""
|
||||
"English Term (Dear translator: This file will never be visible to the user!)"
|
||||
msgstr ""
|
||||
"Deutsche Übersetzung.\n"
|
||||
"Andere deutsche SCM:\n"
|
||||
" http://tortoisesvn.net/docs/release/TortoiseSVN_de/index.html und http://"
|
||||
"tortoisesvn.tigris.org/svn/tortoisesvn/trunk/Languages/Tortoise_de.po "
|
||||
"(username=guest, password empty, gut),\n"
|
||||
" http://msdn.microsoft.com/de-de/library/ms181038(vs.80).aspx (MS Visual "
|
||||
"Source Safe, kommerziell),\n"
|
||||
" http://cvsbook.red-bean.com/translations/german/Kap_06.html "
|
||||
"(mittelmäßig),\n"
|
||||
" http://tortoisecvs.cvs.sourceforge.net/tortoisecvs/po/TortoiseCVS/de_DE.po?"
|
||||
"view=markup (mittelmäßig),\n"
|
||||
" http://rapidsvn.tigris.org/svn/rapidsvn/trunk/src/locale/de/rapidsvn.po "
|
||||
"(username=guest, password empty, schlecht)"
|
||||
|
||||
#. ""
|
||||
msgid "amend"
|
||||
msgstr "nachbessern (ergänzen)"
|
||||
|
||||
#. ""
|
||||
msgid "annotate"
|
||||
msgstr "annotieren"
|
||||
|
||||
#. "A 'branch' is an active line of development."
|
||||
msgid "branch [noun]"
|
||||
msgstr "Zweig"
|
||||
|
||||
#. ""
|
||||
msgid "branch [verb]"
|
||||
msgstr "verzweigen"
|
||||
|
||||
#. ""
|
||||
msgid "checkout [noun]"
|
||||
msgstr ""
|
||||
"Arbeitskopie (Erstellung einer Arbeitskopie; Auscheck? Ausspielung? Abruf? "
|
||||
"Source Safe: Auscheckvorgang)"
|
||||
|
||||
#. "The action of updating the working tree to a revision which was stored in the object database."
|
||||
msgid "checkout [verb]"
|
||||
msgstr ""
|
||||
"Arbeitskopie erstellen; Zweig umstellen [checkout a branch] (auschecken? "
|
||||
"ausspielen? abrufen? Source Safe: auschecken)"
|
||||
|
||||
#. ""
|
||||
msgid "clone [verb]"
|
||||
msgstr "kopieren"
|
||||
|
||||
#. "A single point in the git history."
|
||||
msgid "commit [noun]"
|
||||
msgstr ""
|
||||
"Version; Eintragung; Änderung (Buchung?, Eintragung?, Übertragung?, "
|
||||
"Sendung?, Übergabe?, Einspielung?, Ablagevorgang?)"
|
||||
|
||||
#. "The action of storing a new snapshot of the project's state in the git history."
|
||||
msgid "commit [verb]"
|
||||
msgstr ""
|
||||
"eintragen (TortoiseSVN: übertragen; Source Safe: einchecken; senden?, "
|
||||
"übergeben?, einspielen?, einpflegen?, ablegen?)"
|
||||
|
||||
#. ""
|
||||
msgid "diff [noun]"
|
||||
msgstr "Vergleich (Source Safe: Unterschiede)"
|
||||
|
||||
#. ""
|
||||
msgid "diff [verb]"
|
||||
msgstr "vergleichen"
|
||||
|
||||
#. "A fast-forward is a special type of merge where you have a revision and you are merging another branch's changes that happen to be a descendant of what you have."
|
||||
msgid "fast forward merge"
|
||||
msgstr "Schnellzusammenführung"
|
||||
|
||||
#. "Fetching a branch means to get the branch's head from a remote repository, to find out which objects are missing from the local object database, and to get them, too."
|
||||
msgid "fetch"
|
||||
msgstr "anfordern (holen?)"
|
||||
|
||||
#. "A collection of files. The index is a stored version of your working tree."
|
||||
msgid "index (in git-gui: staging area)"
|
||||
msgstr "Bereitstellung"
|
||||
|
||||
#. "A successful merge results in the creation of a new commit representing the result of the merge."
|
||||
msgid "merge [noun]"
|
||||
msgstr "Zusammenführung"
|
||||
|
||||
#. "To bring the contents of another branch into the current branch."
|
||||
msgid "merge [verb]"
|
||||
msgstr "zusammenführen"
|
||||
|
||||
#. ""
|
||||
msgid "message"
|
||||
msgstr "Beschreibung (Meldung?, Nachricht?; Source Safe: Kommentar)"
|
||||
|
||||
#. "Deletes all stale tracking branches under <name>. These stale branches have already been removed from the remote repository referenced by <name>, but are still locally available in 'remotes/<name>'."
|
||||
msgid "prune"
|
||||
msgstr "entfernen"
|
||||
|
||||
#. "Pulling a branch means to fetch it and merge it."
|
||||
msgid "pull"
|
||||
msgstr "übernehmen (ziehen?)"
|
||||
|
||||
#. "Pushing a branch means to get the branch's head ref from a remote repository, and ... (well, can someone please explain it for mere mortals?)"
|
||||
msgid "push"
|
||||
msgstr "versenden (ausliefern? hochladen? verschicken? schieben?)"
|
||||
|
||||
#. ""
|
||||
msgid "redo"
|
||||
msgstr "wiederholen"
|
||||
|
||||
#. "An other repository ('remote'). One might have a set of remotes whose branches one tracks."
|
||||
msgid "remote"
|
||||
msgstr "Andere Archive (Gegenseite?, Entfernte?, Server?)"
|
||||
|
||||
#. "A collection of refs (?) together with an object database containing all objects which are reachable from the refs... (oops, you've lost me here. Again, please an explanation for mere mortals?)"
|
||||
msgid "repository"
|
||||
msgstr "Projektarchiv"
|
||||
|
||||
#. ""
|
||||
msgid "reset"
|
||||
msgstr "zurücksetzen (zurückkehren?)"
|
||||
|
||||
#. ""
|
||||
msgid "revert"
|
||||
msgstr "revidieren"
|
||||
|
||||
#. "A particular state of files and directories which was stored in the object database."
|
||||
msgid "revision"
|
||||
msgstr "Version (TortoiseSVN: Revision; Source Safe: Version)"
|
||||
|
||||
#. ""
|
||||
msgid "sign off"
|
||||
msgstr "abzeichnen (gegenzeichnen?, freizeichnen?, absegnen?)"
|
||||
|
||||
#. ""
|
||||
msgid "staging area"
|
||||
msgstr "Bereitstellung"
|
||||
|
||||
#. ""
|
||||
msgid "status"
|
||||
msgstr "Status"
|
||||
|
||||
#. "A ref pointing to a tag or commit object"
|
||||
msgid "tag [noun]"
|
||||
msgstr "Markierung"
|
||||
|
||||
#. ""
|
||||
msgid "tag [verb]"
|
||||
msgstr "markieren"
|
||||
|
||||
#. "A regular git branch that is used to follow changes from another repository."
|
||||
msgid "tracking branch"
|
||||
msgstr "Übernahmezweig"
|
||||
|
||||
#. ""
|
||||
msgid "undo"
|
||||
msgstr "rückgängig"
|
||||
|
||||
#. ""
|
||||
msgid "update"
|
||||
msgstr "aktualisieren"
|
||||
|
||||
#. ""
|
||||
msgid "verify"
|
||||
msgstr "überprüfen"
|
||||
|
||||
#. "The tree of actual checked out files."
|
||||
msgid "working copy, working tree"
|
||||
msgstr "Arbeitskopie"
|
||||
164
git-gui/po/glossary/git-gui-glossary.pot
Normal file
164
git-gui/po/glossary/git-gui-glossary.pot
Normal file
@@ -0,0 +1,164 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR Free Software Foundation, Inc.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 21:43+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: ENCODING\n"
|
||||
|
||||
#. "English Definition (Dear translator: This file will never be visible to the user! It should only serve as a tool for you, the translator. Nothing more.)"
|
||||
msgid "English Term (Dear translator: This file will never be visible to the user!)"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "amend"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "annotate"
|
||||
msgstr ""
|
||||
|
||||
#. "A 'branch' is an active line of development."
|
||||
msgid "branch [noun]"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "branch [verb]"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "checkout [noun]"
|
||||
msgstr ""
|
||||
|
||||
#. "The action of updating the working tree to a revision which was stored in the object database."
|
||||
msgid "checkout [verb]"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "clone [verb]"
|
||||
msgstr ""
|
||||
|
||||
#. "A single point in the git history."
|
||||
msgid "commit [noun]"
|
||||
msgstr ""
|
||||
|
||||
#. "The action of storing a new snapshot of the project's state in the git history."
|
||||
msgid "commit [verb]"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "diff [noun]"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "diff [verb]"
|
||||
msgstr ""
|
||||
|
||||
#. "A fast-forward is a special type of merge where you have a revision and you are merging another branch's changes that happen to be a descendant of what you have."
|
||||
msgid "fast forward merge"
|
||||
msgstr ""
|
||||
|
||||
#. "Fetching a branch means to get the branch's head from a remote repository, to find out which objects are missing from the local object database, and to get them, too."
|
||||
msgid "fetch"
|
||||
msgstr ""
|
||||
|
||||
#. "A collection of files. The index is a stored version of your working tree."
|
||||
msgid "index (in git-gui: staging area)"
|
||||
msgstr ""
|
||||
|
||||
#. "A successful merge results in the creation of a new commit representing the result of the merge."
|
||||
msgid "merge [noun]"
|
||||
msgstr ""
|
||||
|
||||
#. "To bring the contents of another branch into the current branch."
|
||||
msgid "merge [verb]"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "message"
|
||||
msgstr ""
|
||||
|
||||
#. "Deletes all stale tracking branches under <name>. These stale branches have already been removed from the remote repository referenced by <name>, but are still locally available in 'remotes/<name>'."
|
||||
msgid "prune"
|
||||
msgstr ""
|
||||
|
||||
#. "Pulling a branch means to fetch it and merge it."
|
||||
msgid "pull"
|
||||
msgstr ""
|
||||
|
||||
#. "Pushing a branch means to get the branch's head ref from a remote repository, and ... (well, can someone please explain it for mere mortals?)"
|
||||
msgid "push"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "redo"
|
||||
msgstr ""
|
||||
|
||||
#. "An other repository ('remote'). One might have a set of remotes whose branches one tracks."
|
||||
msgid "remote"
|
||||
msgstr ""
|
||||
|
||||
#. "A collection of refs (?) together with an object database containing all objects which are reachable from the refs... (oops, you've lost me here. Again, please an explanation for mere mortals?)"
|
||||
msgid "repository"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "reset"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "revert"
|
||||
msgstr ""
|
||||
|
||||
#. "A particular state of files and directories which was stored in the object database."
|
||||
msgid "revision"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "sign off"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "staging area"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "status"
|
||||
msgstr ""
|
||||
|
||||
#. "A ref pointing to a tag or commit object"
|
||||
msgid "tag [noun]"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "tag [verb]"
|
||||
msgstr ""
|
||||
|
||||
#. "A regular git branch that is used to follow changes from another repository."
|
||||
msgid "tracking branch"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "undo"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "update"
|
||||
msgstr ""
|
||||
|
||||
#. ""
|
||||
msgid "verify"
|
||||
msgstr ""
|
||||
|
||||
#. "The tree of actual checked out files."
|
||||
msgid "working copy, working tree"
|
||||
msgstr ""
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user