Commit graph

1304 commits

Author SHA1 Message Date
Gary Gibbons 0591cfa8d8 git-p4: ensure submit clientPath exists before chdir
Submitting patches back to p4 requires a p4 "client".  This
is a mapping from server depot paths into a local directory.
The directory need not exist or be populated with files; only
the mapping on the server is required.  When there is no
directory, make git-p4 automatically create it.

[ reword description --pw ]

Signed-off-by: Gary Gibbons <ggibbons@perforce.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-11 21:12:55 -08:00
Junio C Hamano d2c7807549 Merge branch 'sg/complete-refs'
* sg/complete-refs:
  completion: remove broken dead code from __git_heads() and __git_tags()
  completion: fast initial completion for config 'remote.*.fetch' value
  completion: improve ls-remote output filtering in __git_refs_remotes()
  completion: query only refs/heads/ in __git_refs_remotes()
  completion: support full refs from remote repositories
  completion: improve ls-remote output filtering in __git_refs()
  completion: make refs completion consistent for local and remote repos
  completion: optimize refs completion
  completion: document __gitcomp()

Conflicts:
	contrib/completion/git-completion.bash
2011-12-09 13:37:18 -08:00
Pete Wyckoff 7c766e57e8 git-p4: introduce skipSubmitEdit
Add a configuration variable to skip invoking the editor in the
submit path.

The existing variable skipSubmitEditCheck continues to make sure
that the submit template was indeed modified by the editor; but,
it is not considered if skipSubmitEdit is true.

Reported-by: Loren A. Linden Levy <lindenle@gmail.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-05 14:43:22 -08:00
Junio C Hamano 248dbbe832 Merge branch 'sn/complete-bash-wo-process-subst'
* sn/complete-bash-wo-process-subst:
  completion: don't leak variable from the prompt into environment
2011-11-09 05:46:39 -08:00
SZEDER Gábor 4804d43791 completion: don't leak variable from the prompt into environment
Commit e5b8eebc (completion: fix issue with process substitution not
working on Git for Windows, 2011-10-26) introduced a new variable in
__git_ps1_show_upstream(), but didn't declare it as local to prevent it
from leaking into the environment.

We may want to rewrite it like the following, but that can wait until the
next cycle.

	while read key value
	do
		...
	done <<-EOF
	$(git config -z --get-regexp ...)
	EOF

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-09 05:44:05 -08:00
Junio C Hamano de26347950 Merge branch 'pw/p4-appledouble-fix'
* pw/p4-appledouble-fix:
  git-p4: ignore apple filetype
2011-11-06 21:21:57 -08:00
Pete Wyckoff 9f7ef0eaf2 git-p4: ignore apple filetype
Revert 97a21ca (git-p4: stop ignoring apple filetype, 2011-10-16)
and add a test case.

Reported-by: Michael Wookey <michaelwookey@gmail.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-05 23:17:52 -07:00
Junio C Hamano 324bc2a7ee Merge branch 'jk/git-tricks'
* jk/git-tricks:
  completion: match ctags symbol names in grep patterns
  contrib: add git-jump script
  contrib: add diff highlight script
2011-10-30 19:13:13 -07:00
Junio C Hamano 4801546528 Merge branch 'sn/complete-bash-wo-process-subst'
* sn/complete-bash-wo-process-subst:
  completion: fix issue with process substitution not working on Git for Windows
2011-10-27 12:04:28 -07:00
Junio C Hamano 2ef89f3856 Merge branch 'mm/mediawiki-author-fix'
* mm/mediawiki-author-fix:
  git-remote-mediawiki: don't include HTTP login/password in author
2011-10-26 16:16:31 -07:00
Stefan Naewe e5b8eebc03 completion: fix issue with process substitution not working on Git for Windows
Git for Windows comes with a bash that doesn't support process substitution.
It issues the following error when using git-completion.bash with
GIT_PS1_SHOWUPSTREAM set:

$ export GIT_PS1_SHOWUPSTREAM=1
sh.exe": cannot make pipe for process substitution: Function not implemented
sh.exe": cannot make pipe for process substitution: Function not implemented
sh.exe": <(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n '): ambiguous redirect

Replace the process substitution with a 'here string'.

Signed-off-by: Stefan Naewe <stefan.naewe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-26 14:05:47 -07:00
Junio C Hamano 5a4fcc28e1 Merge branch 'pw/p4-update'
* pw/p4-update:
  git-p4: handle files with shell metacharacters
  git-p4: keyword flattening fixes
  git-p4: stop ignoring apple filetype
  git-p4: recognize all p4 filetypes
  git-p4: handle utf16 filetype properly
  git-p4 tests: refactor and cleanup
2011-10-21 16:04:33 -07:00
SZEDER Gábor 6486ca6d77 completion: remove broken dead code from __git_heads() and __git_tags()
__git_heads() was introduced in 5de40f5 (Teach bash about
git-repo-config., 2006-11-27), and __git_tags() in 88e21dc (Teach bash
about completing arguments for git-tag, 2007-08-31).  As their name
suggests, __git_heads() is supposed to list only branches, and
__git_tags() only tags.

Since their introduction both of these functions consist of two
distinct parts.  The first part gets branches or tags, respectively,
from a local repositoty using 'git for-each-ref'.  The second part
queries a remote repository given as argument using 'git ls-remote'.

These remote-querying parts are broken in both functions since their
introduction, because they list both branches and tags from the remote
repository.  (The 'git ls-remote' query is not limited to list only
heads or tags, respectively, and the for loop filtering the query
results prints everything except dereferenced tags.)  This breakage
could be easily fixed by passing the '--heads' or '--tags' options or
appropriate refs patterns to the 'git ls-remote' invocations.

However, that no one noticed this breakage yet is probably not a
coincidence: neither of these two functions were used to query a
remote repository, the remote-querying parts were dead code already
upon thier introduction and remained dead ever since.

Since those parts of code are broken, are and were never used, stop
the bit-rotting and remove them.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21 14:38:23 -07:00
SZEDER Gábor d51a8ecd5f completion: fast initial completion for config 'remote.*.fetch' value
Refspecs for branches in a remote repository start with 'refs/heads/',
so completing those refspecs with 'git config remote.origin.fetch
<TAB>' always offers 'refs/heads/' first, because that's the unique
part of the possible refspecs.  But it does so only after querying the
remote with 'git ls-remote', which can take a while when the request
goes through some slower network to a remote server.

Don't waste the user's time and offer 'refs/heads/' right away for
'git config remote.origin.fetch <TAB>'.

The reason for putting 'refs/heads/' directly into COMPREPLY instead
of using __gitcomp() is to avoid __gitcomp() adding a trailing space.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21 14:38:23 -07:00
SZEDER Gábor 48058f5df4 completion: improve ls-remote output filtering in __git_refs_remotes()
This follows suit of a previous patch for __git_refs(): use a
while-read loop and let bash's word splitting get rid of object names
from 'git ls-remote's output.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21 14:38:23 -07:00
SZEDER Gábor d79bcf2cf2 completion: query only refs/heads/ in __git_refs_remotes()
__git_refs_remotes() is used to provide completion for refspecs to set
'remote.*.fetch' config variables for branches on the given remote.
So it's really only interested in refs under 'refs/heads/', but it
queries the remote for all its refs and then filters out all refs
outside of 'refs/heads/'.

Let 'git ls-remote' do the filtering.

Also remove the unused $cmd variable from __git_refs_remotes().

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21 14:38:23 -07:00
SZEDER Gábor fb772cca2b completion: support full refs from remote repositories
When the __git_refs() completion helper function lists refs from a
local repository, it usually lists the refs' short name, except when
it needs to provide completion for words starting with refs, because
in that case it lists full ref names, see 608efb87 (bash: complete
full refs, 2008-11-28).

Add the same functionality to the code path dealing with remote
repositories, too.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21 14:38:23 -07:00
SZEDER Gábor d8c0453e1a completion: improve ls-remote output filtering in __git_refs()
The remote-handling part of __git_refs() has a nice for loop and state
machine case statement to iterate over all words from the output of
'git ls-remote' to identify object names and ref names.  Since each
line in the output of 'git ls-remote' consists of an object name and a
ref name, we can do more effective filtering by using a while-read
loop and letting bash's word splitting take care of object names.
This way the code is easier to understand and the loop will need only
half the number of iterations than before.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21 14:38:23 -07:00
SZEDER Gábor abf05987de completion: make refs completion consistent for local and remote repos
For a local repository the __git_refs() completion helper function
lists refs under 'refs/(tags|heads|remotes)/', plus some special refs
like HEAD and ORIG_HEAD.  For a remote repository, however, it lists
all refs.

Fix this inconsistency by specifying refs filter patterns for 'git
ls-remote' to only list refs under 'refs/(tags|heads|remotes)/'.

For now this makes it impossible to complete refs outside of
'refs/(tags|heads|remotes)/' in a remote repository, but a followup
patch will resurrect that.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21 14:38:23 -07:00
SZEDER Gábor a31e62629a completion: optimize refs completion
After a unique command or option is completed, in most cases it is a
good thing to add a trailing a space, but sometimes it doesn't make
sense, e.g. when the completed word is an option taking an argument
('--option=') or a configuration section ('core.').  Therefore the
completion script uses the '-o nospace' option to prevent bash from
automatically appending a space to unique completions, and it has the
__gitcomp() function to add that trailing space only when necessary.
See 72e5e989 (bash: Add space after unique command name is completed.,
2007-02-04), 78d4d6a2 (bash: Support unique completion on git-config.,
2007-02-04), and b3391775 (bash: Support unique completion when
possible., 2007-02-04).

__gitcomp() therefore iterates over all possible completion words it
got as argument, and checks each word whether a trailing space is
necessary or not.  This is ok for commands, options, etc., i.e. when
the number of words is relatively small, but can be noticeably slow
for large number of refs.  However, while options might or might not
need that trailing space, refs are always handled uniformly and always
get that trailing space (or a trailing '.' for 'git config
branch.<head>.').  Since refs listed by __git_refs() & co. are
separated by newline, this allows us some optimizations with
'compgen'.

So, add a specialized variant of __gitcomp() that only deals with
possible completion words separated by a newline and uniformly appends
the trailing space to all words using 'compgen -S " "' (or any other
suffix, if specified), so no iteration over all words is needed.  But
we need to fiddle with IFS, because the default IFS containing a space
would cause the added space suffix to be stripped off when compgen's
output is stored in the COMPREPLY array.  Therefore we use only
newline as IFS, hence the requirement for the newline-separated
possible completion words.

Convert all callsites of __gitcomp() where it's called with refs, i.e.
when it gets the output of either __git_refs(), __git_heads(),
__git_tags(), __git_refs2(), __git_refs_remotes(), or the odd 'git
for-each-ref' somewhere in _git_config().  Also convert callsites
where it gets other uniformly handled newline separated word lists,
i.e. either remotes from __git_remotes(), names of set configuration
variables from __git_config_get_set_variables(), stashes, or commands.

Here are some timing results for dealing with 10000 refs.
Before:

  $ refs="$(__git_refs ~/tmp/git/repo-with-10k-refs/)"
  $ time __gitcomp "$refs"

  real	0m1.134s
  user	0m1.060s
  sys	0m0.130s

After:

  $ time __gitcomp_nl "$refs"

  real	0m0.373s
  user	0m0.360s
  sys	0m0.020s

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21 14:38:22 -07:00
SZEDER Gábor f674bb8078 completion: document __gitcomp()
I always forget which argument is which, and got tired of figuring it
out over and over again.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21 14:38:22 -07:00
Jeff King 29eec71f21 completion: match ctags symbol names in grep patterns
A common thing to grep for is the name of a symbol. This
patch teaches the completion for "git grep" to look in
a 'tags' file, if present, to complete a pattern. For
example, in git.git:

  $ make tags
  $ git grep get_sha1<Tab><Tab>
  get_sha1                 get_sha1_oneline
  get_sha1_1               get_sha1_with_context
  get_sha1_basic           get_sha1_with_context_1
  get_sha1_hex             get_sha1_with_mode
  get_sha1_hex_segment     get_sha1_with_mode_1
  get_sha1_mb

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21 13:56:54 -07:00
Jeff King 21e4631c07 contrib: add git-jump script
This is a small script for helping your editor jump to
specific points of interest. See the README for details.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21 13:55:59 -07:00
Matthieu Moy 9fb79503e6 git-remote-mediawiki: don't include HTTP login/password in author
On the MediaWiki side, the author information is just the MediaWiki login
of the contributor. The import turns it into login@$wiki_name to create
the author's email address on the wiki side. But we don't want this to
include the HTTP password if it's present in the URL ...

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-20 10:17:14 -07:00
Jeff King 927a13fe87 contrib: add diff highlight script
This is a simple and stupid script for highlighting
differing parts of lines in a unified diff. See the README
for a discussion of the limitations.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-18 00:01:18 -07:00
Junio C Hamano 6e97fccf0c Merge branch 'sg/completion'
* sg/completion:
  completion: unite --format and --pretty for 'log' and 'show'
  completion: unite --reuse-message and --reedit-message for 'notes'
2011-10-17 21:37:13 -07:00
Junio C Hamano 33ce7c11eb Merge branch 'tm/completion-push-set-upstream'
* tm/completion-push-set-upstream:
  completion: push --set-upstream
2011-10-17 21:37:11 -07:00
Junio C Hamano c795df7c0a Merge branch 'tm/completion-commit-fixup-squash'
* tm/completion-commit-fixup-squash:
  completion: commit --fixup and --squash
  completion: unite --reuse-message and --reedit-message handling
2011-10-17 21:37:10 -07:00
Pete Wyckoff 97a21ca50e git-p4: stop ignoring apple filetype
Currently "apple" filetype is ignored explicitly, and the file is
not even included in the git repository.  This seems wrong.
Remove this, letting it be treated like a "binary" filetype.

Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-17 20:46:49 -07:00
Luke Diamand 6de040df56 git-p4: handle files with shell metacharacters
git-p4 used to simply pass strings into system() and popen(), and
relied on the shell doing the necessary expansion. This though meant
that shell metacharacters in file names would be corrupted - for
example files with $ or space in them.

Switch to using subprocess.Popen() and friends, and pass in explicit
arrays in the places where it matters. This then avoids needing shell
expansion.

Add trivial helper functions for some common perforce operations. Add
test case.

[pw: test cleanup]

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-17 20:46:49 -07:00
Pete Wyckoff 9cffb8c8bf git-p4: recognize all p4 filetypes
The previous code was approximate in the filetypes it recognized.
Put in the canonical list and be more careful about matching
elements of the file type.

This might change behavior in some cases, hopefully for the
better.  Windows newline mangling will now happen on all
text files.  Previously some like "text+ko" were oddly exempt.

Files with multiple combinations of modifiers, like "text+klx",
are now recognized for keyword expansion.  I expect these to be
seen only rarely.

Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-17 20:46:49 -07:00
Pete Wyckoff cb585a9cda git-p4: keyword flattening fixes
Join the text before looking for keywords.  There is nothing to
prevent the p4 output marshaller from splitting in the middle of a
keyword, although it has never been known to happen.

Also remove the (?i) regexp modifier; perforce keywords are
documented as case-sensitive.

Remove the "\n" end-character match.  I don't know why that is
in there, and every keyword in a fairly large production p4 repository
always ends with a $.

Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-17 20:46:49 -07:00
Pete Wyckoff 55aa5714af git-p4: handle utf16 filetype properly
One of the filetypes that p4 supports is utf16.  Its behavior is
odd in this case.  The data delivered through "p4 -G print" is
not encoded in utf16, although "p4 print -o" will produce the
proper utf16-encoded file.

When dealing with this filetype, discard the data from -G, and
instead read the contents directly.

An alternate approach would be to try to encode the data in
python.  That worked for true utf16 files, but for other files
marked as utf16, p4 delivers mangled text in no recognizable encoding.

Add a test case to check utf16 handling, and +k and +ko handling.

Reported-by: Chris Li <git@chrisli.org>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-17 20:45:28 -07:00
SZEDER Gábor e67d71e559 completion: unite --format and --pretty for 'log' and 'show'
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-10 10:02:55 -07:00
SZEDER Gábor a8f89bfa99 completion: unite --reuse-message and --reedit-message for 'notes'
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-10 10:00:13 -07:00
Teemu Matilainen 3623dc0310 completion: push --set-upstream
Signed-off-by: Teemu Matilainen <teemu.matilainen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-06 15:12:31 -07:00
Teemu Matilainen 77653abd98 completion: commit --fixup and --squash
Signed-off-by: Teemu Matilainen <teemu.matilainen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-06 15:11:50 -07:00
Teemu Matilainen f8e49e132c completion: unite --reuse-message and --reedit-message handling
Signed-off-by: Teemu Matilainen <teemu.matilainen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-06 15:11:49 -07:00
Junio C Hamano 2e49dab8a1 Merge branch 'mm/mediawiki-as-a-remote'
* mm/mediawiki-as-a-remote:
  git-remote-mediawiki: allow a domain to be set for authentication
  git-remote-mediawiki: obey advice.pushNonFastForward
  git-remote-mediawiki: set 'basetimestamp' to let the wiki handle conflicts
  git-remote-mediawiki: trivial fixes
  git-remote-mediawiki: allow push to set MediaWiki metadata
  Add a remote helper to interact with mediawiki (fetch & push)
2011-10-05 12:36:27 -07:00
Matthieu Moy 1d6abac9d5 git-remote-mediawiki: allow a domain to be set for authentication
When the wiki uses e.g. LDAP for authentication, the web interface shows
a popup to allow the user to chose an authentication domain, and we need
to use lgdomain in the API at login time.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-28 15:20:23 -07:00
Matthieu Moy fd47d7b94d git-remote-mediawiki: obey advice.pushNonFastForward
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-27 11:25:03 -07:00
Matthieu Moy 3c1ed90ec3 git-remote-mediawiki: set 'basetimestamp' to let the wiki handle conflicts
We already have a check that no new revisions are on the wiki at the
beginning of the push, but this didn't handle concurrent accesses to the
wiki.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-27 11:25:02 -07:00
Matthieu Moy ac86ec0f5e git-remote-mediawiki: trivial fixes
Fix a whitespace issue (no space before :) and remove unused %status in
mw_push.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-27 11:25:02 -07:00
Gerrit Pape f6f17885ba contrib/hooks: adapt comment about Debian install location for contrib hooks
Placing the contrib hooks into /usr/share/doc/ wasn't a good idea in the
first place.  According to the Debian policy they should be located in
/usr/share/git-core/, so let's put them there.

Thanks to Bill Allombert for reporting this through
 http://bugs.debian.org/640949

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-26 16:39:34 -07:00
Matthieu Moy 93f0d33818 git-remote-mediawiki: allow push to set MediaWiki metadata
Push can not set the commit note "mediawiki_revision:" and update the
remote reference. This avoids having to "git pull --rebase" after each
push, and is probably more natural. Make it the default, but let it be
configurable with mediawiki.dumbPush or remote.<remotename>.dumbPush.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-01 15:52:57 -07:00
Jeremie Nikaes 428c995c4e Add a remote helper to interact with mediawiki (fetch & push)
Implement a gate between git and mediawiki, allowing git users to push
and pull objects from mediawiki just as one would do with a classic git
repository thanks to remote-helpers.

The following packages need to be installed (available on common
repositories):

  libmediawiki-api-perl
  libdatetime-format-iso8601-perl

Use remote helpers in order to be as transparent as possible to the git
user.

Download Mediawiki revisions through the Mediawiki API and then
fast-import into git.

Mediawiki revision number and git commits are linked thanks to notes
bound to commits.

The import part is done on a refs/mediawiki/<remote> branch before
coming to refs/remote/origin/master (Huge thanks to Jonathan Nieder
for his help)

We use UTF-8 everywhere: use encoding 'utf8'; does most of the job, but
we also read the output of Git commands in UTF-8 with the small helper
run_git, and write to the console (STDERR) in UTF-8. This allows a
seamless use of non-ascii characters in page titles, but hasn't been
tested on non-UTF-8 systems. In particular, UTF-8 encoding for filenames
could raise problems if different file systems handle UTF-8 filenames
differently. A uri_escape of mediawiki filenames could be imaginable, and
is still to be discussed further.

Partial cloning is supported using one of:

git clone -c remote.origin.pages='A_Page  Another_Page' mediawiki::http://wikiurl

git clone -c remote.origin.categories='Some_Category' mediawiki::http://wikiurl

git clone -c remote.origin.shallow='True' mediawiki::http://wikiurl

Thanks to notes metadata, it is possible to compare remote and local last
mediawiki revision to warn non-fast forward pushes and "everything
up-to-date" case.

When allowed, push looks for each commit between remotes/origin/master
and HEAD, catches every blob related to these commit and push them in
chronological order. To do so, it uses git rev-list --children HEAD and
travels the tree from remotes/origin/master to HEAD through children. In
other words:

* Shortest path from remotes/origin/master to HEAD
* For each commit encountered, push blobs related to this commit

Signed-off-by: Jérémie Nikaes <jeremie.nikaes@ensimag.imag.fr>
Signed-off-by: Arnaud Lacurie <arnaud.lacurie@ensimag.imag.fr>
Signed-off-by: Claire Fousse <claire.fousse@ensimag.imag.fr>
Signed-off-by: David Amouyal <david.amouyal@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Sylvain Boulmé <sylvain.boulme@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-01 15:52:55 -07:00
Junio C Hamano cfd2f0f558 Merge branch 'va/p4-branch-import'
* va/p4-branch-import:
  git-p4: Add simple test case for branch import
  git-p4: Allow branch definition with git config
  git-p4: Allow filtering Perforce branches by user
  git-p4: Correct branch base depot path detection
  git-p4: Process detectCopiesHarder with --bool
  git-p4: Add test case for copy detection
  git-p4: Add test case for rename detection
  git-p4: Add description of rename/copy detection options
  git-p4: Allow setting rename/copy detection threshold
2011-08-28 21:15:34 -07:00
Vitor Antunes 7199cf131c git-p4: Allow branch definition with git config
Perforce does not strictly require the usage of branch specifications to create
branches. In these cases the branch detection code of git-p4 will not be able to
import them.
This patch adds support for git-p4.branchList configuration option, allowing
branches to be defined in git config.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22 21:08:37 -07:00
Vitor Antunes 8ace74c00e git-p4: Allow filtering Perforce branches by user
All branches in the Perforce server are downloaded to allow branch detection. If
you have a centralized server on a remote location and there is a big number of
branches this operation can take some time.
This patch adds the configuration option git-p4.branchUser to allow filtering
the branch list by user. Although this limits the branch maintenance in Perforce
to be done by a single user, it might be an advantage when the number of
branches being used in a specific depot is very small when compared with the
branches available in the server.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22 21:08:37 -07:00
Vitor Antunes 04d277b39e git-p4: Correct branch base depot path detection
When branch detection is enabled each branch is named in git after their
relative depot path in Perforce. To do this the depot paths are compared against
each other to find their common base path. The current algorithm makes this
comparison on a character by character basis.
Assuming we have the following branches:

  //depot/branches/featureA
  //depot/branches/featureB

Then the base depot path would be //depot/branches/feature, which is an invalid
depot path.

The current patch fixes this by splitting the path into a list and comparing the
list entries, making it choose correctly //depot/branches as the base path.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22 21:08:37 -07:00