Commit graph

151 commits

Author SHA1 Message Date
Jonathan Nieder 962393b5d9 Merge branch 'maint'
* maint:
  git-remote-mediawiki: bugfix for pages w/ >500 revisions
2013-09-24 23:19:00 -07:00
Benoit Person 1d905f74fd git-remote-mediawiki: bugfix for pages w/ >500 revisions
Mediawiki introduces a new API for queries w/ more than 500 results in
version 1.21. That change triggered an infinite loop while cloning a
mediawiki with such a page.

The latest API renamed and moved the "continuing" information in the
response, necessary to build the next query. The code failed to retrieve
that information but still detected that it was in a "continuing
query". As a result, it launched the same query over and over again.

If a "continuing" information is detected in the response (old or new),
the next query is updated accordingly. If not, we quit assuming it's not
a continuing query.

Reported-by: Benjamin Cathey
Signed-off-by: Benoit Person <benoit.person@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2013-09-24 12:42:21 -07:00
Matthieu Moy f19f5e60f6 git-remote-mediawiki: no need to update private ref in non-dumb push
We used to update the private ref ourselves, but this update is now
done by default since 664059fb (transport-helper: update remote
helper namespace, 2013-04-17).

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-09-03 11:58:17 -07:00
Matthieu Moy aa38dc68ea git-remote-mediawiki: use no-private-update capability on dumb push
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-09-03 11:58:12 -07:00
Matthieu Moy 8987cda9e1 git-remote-mediawiki: add test and check Makefile targets
There are a few level 4 and 2 perlcritic issues in the current code. We
make level 5 fatal, and keep level 2 as warnings.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-29 12:07:24 -07:00
Matthieu Moy 8ed205a380 git-remote-mediawiki: ignore generated git-mw
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-13 09:52:22 -07:00
Junio C Hamano b12aecda2c Merge branch 'bp/mediawiki-preview'
Add a command to allow previewing the contents locally before
pushing it out, when working with a MediaWiki remote.

I personally do not think this belongs to Git.  If you are working
on a set of AsciiDoc source files, you sure do want to locally
format to preview what you will be pushing out, and if you are
working on a set of C or Java source files, you do want to test it
before pushing it out, too.  That kind of thing belongs to your
build script, not to your SCM.

But I'll let it pass, as this is only a contrib/ thing.

* bp/mediawiki-preview:
  git-remote-mediawiki: add preview subcommand into git mw
  git-remote-mediawiki: add git-mw command
  git-remote-mediawiki: factoring code between git-remote-mediawiki and Git::Mediawiki
  git-remote-mediawiki: update tests to run with the new bin-wrapper
  git-remote-mediawiki: add a git bin-wrapper for developement
  wrap-for-bin: make bin-wrappers chainable
  git-remote-mediawiki: introduction of Git::Mediawiki.pm
2013-07-18 12:59:34 -07:00
Benoit Person 0078a7fa05 git-remote-mediawiki: add preview subcommand into git mw
In the current state, a user of git-remote-mediawiki can edit the markup text
locally, but has to push to the remote wiki to see how the page is rendererd.
Add a new 'git mw preview' command that allows rendering the markup text on
the remote wiki without actually pushing any change on the wiki.

This uses Mediawiki's API to render the markup and inserts it in an actual
HTML page from the wiki so that CSS can be rendered properly. Most links
should work when the page exists on the remote.

Signed-off-by: Benoit Person <benoit.person@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 08:56:14 -07:00
Benoit Person 07a263b905 git-remote-mediawiki: add git-mw command
For now, git-remote-mediawiki is only a remote-helper. This patch adds a new
toolset script in which we will be able to build new tools for
git-remote-mediawiki.

This toolset uses a subcommand-mechanism to launch the proper action. For now
only the 'help' subcommand is implemented. It also provides some generic code
for the verbose and help command line options.

Signed-off-by: Benoit Person <benoit.person@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 08:56:08 -07:00
Benoit Person 192f7a0804 git-remote-mediawiki: factoring code between git-remote-mediawiki and Git::Mediawiki
For now, Git::Mediawiki contains nothing.

This first patch moves some of git-remote-mediawiki.perl's factorisable code
into Git::Mediawiki. In the same time, it removes the side effects of that code
and renames the fucntions and constants moved to expose a better API.

Signed-off-by: Benoit Person <benoit.person@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 08:56:00 -07:00
Benoit Person c7956f9084 git-remote-mediawiki: update tests to run with the new bin-wrapper
Until now, if git-remote-mediawiki was not installed, the test suite
copied it to the toplevel directory. This solution pollutes the
directory with untracked files. Plus, we would need to copy the new
git-mw.perl file to test it too.

Signed-off-by: Benoit Person <benoit.person@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 08:55:56 -07:00
Benoit Person 8a7c215140 git-remote-mediawiki: add a git bin-wrapper for developement
The introduction of the Git::Mediawiki package makes it impossible to test,
without installation, git-remote-mediawiki and git-mw.

Using a git bin-wrapper enables us to define proper $GITPERLLIB to force the
use of the developement version of the Git::Mediawiki package, bypassing its
installed version if any.

An alternate solution was to 'install' all the files required at each build
but it pollutes the toplevel with untracked files.

Signed-off-by: Benoit Person <benoit.person@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 08:55:53 -07:00
Benoit Person e19189060f git-remote-mediawiki: introduction of Git::Mediawiki.pm
We would want to allow the user to preview what he has edited locally
before pushing it out (and thus creating a non-removable revision in
the mediawiki's history).

This patch introduces a new perl package in which we will be able to
share code between that new tool and the remote helper:
git-remote-mediawiki.perl.

A perl package offers the best way to handle such case: Each script
can select what should be imported in its namespace.  The package
namespacing limits the use of side effects in the shared code.

An alternate solution is to concatenate a "toolset" file with each
*.perl when 'make'-ing the project. In that scheme, everything is
imported in the script's namespace. Plus, files should be renamed in
order to chain to Git's toplevel makefile. Hence, this solution is not
acceptable.

Signed-off-by: Benoit Person <benoit.person@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-08 08:55:21 -07:00
Matthieu Moy 0e7c41c0cd git-remote-mediawiki: un-brace file handles in binmode calls
Commit e83d36b66f turned "print STDOUT" into "print {*STDOUT}", as
suggested by perlcritic. Unfortunately, it also changed two "binmode
STDOUT" calls the same way, which does not work and yield a "Not a GLOB
reference" error.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-03 12:10:13 -07:00
Junio C Hamano 39abbd38d8 Merge branch 'cm/remote-mediawiki-perlcritique'
* cm/remote-mediawiki-perlcritique: (31 commits)
  git-remote-mediawiki: make error message more precise
  git-remote-mediawiki: add a perlcritic rule in Makefile
  git-remote-mediawiki: add a .perlcriticrc file
  git-remote-mediawiki: clearly rewrite double dereference
  git-remote-mediawiki: fix a typo ("mediwiki" instead of "mediawiki")
  git-remote-mediawiki: put non-trivial numeric values in constants.
  git-remote-mediawiki: don't use quotes for empty strings
  git-remote-mediawiki: replace "unless" statements with negated "if" statements
  git-remote-mediawiki: brace file handles for print for more clarity
  git-remote-mediawiki: modify strings for a better coding-style
  git-remote-mediawiki: put long code into a subroutine
  git-remote-mediawiki: remove import of unused open2
  git-remote-mediawiki: check return value of open
  git-remote-mediawiki: assign a variable as undef and make proper indentation
  git-remote-mediawiki: rename a variable ($last) which has the name of a keyword
  git-remote-mediawiki: remove unused variable $entry
  git-remote-mediawiki: turn double-negated expressions into simple expressions
  git-remote-mediawiki: change the name of a variable
  git-remote-mediawiki: add newline in the end of die() error messages
  git-remote-mediawiki: change style in a regexp
  ...
2013-06-23 14:53:14 -07:00
Junio C Hamano 7f031ed5ab Merge branch 'bp/remote-mw-tests'
* bp/remote-mw-tests:
  git-remote-mediawiki: remove hardcoded version number in the test suite
2013-06-23 14:53:11 -07:00
Junio C Hamano 0c36f3a198 Merge branch 'cm/remote-mediawiki'
* cm/remote-mediawiki:
  git-remote-mediawiki: display message when launched directly
2013-06-20 16:02:42 -07:00
Benoit Person 3e3d5fd276 git-remote-mediawiki: remove hardcoded version number in the test suite
Updates the code to make it more easy to switch mediawiki version when
testing. Before that, the version number was partly hardcoded, partly
in a var.

Signed-off-by: Benoit Person <benoit.person@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 11:09:49 -07:00
Célestin Matte d8e7c67e13 git-remote-mediawiki: make error message more precise
In subroutine parse_command, error messages were not correct. For the "import"
function, having too much or incorrect arguments displayed both
"invalid arguments", while it displayed "too many arguments" for the "option"
functions under the same conditions.
Separate the two error messages in both cases.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:18 -07:00
Célestin Matte e3e7d34513 git-remote-mediawiki: add a perlcritic rule in Makefile
Option "-2" launches perlcritic with level 2. Levels go from 5 (most pertinent)
to 1. Rules of level 1 are mostly a question of style, and are therefore
ignored.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:18 -07:00
Célestin Matte b5cda5b313 git-remote-mediawiki: add a .perlcriticrc file
Such a file allows to configure perlcritic.
Here, it is used to remove many unwanted rules and configure one to
remove unwanted warnings.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:18 -07:00
Célestin Matte d49a038451 git-remote-mediawiki: clearly rewrite double dereference
@$var structures are re-written in the following way: @{$var}
It makes them more readable.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:18 -07:00
Célestin Matte 7c47583793 git-remote-mediawiki: fix a typo ("mediwiki" instead of "mediawiki")
Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:18 -07:00
Célestin Matte fed56c06ae git-remote-mediawiki: put non-trivial numeric values in constants.
Non-trivial numeric values (e.g., different from 0, 1 and 2) are placed in
constants at the top of the code to be easily modifiable and to make more sense

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:18 -07:00
Célestin Matte aeb95eeaff git-remote-mediawiki: don't use quotes for empty strings
Empty strings are replaced by an $EMPTY constant.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:18 -07:00
Célestin Matte b8b4e1b385 git-remote-mediawiki: replace "unless" statements with negated "if" statements
Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:18 -07:00
Célestin Matte e83d36b66f git-remote-mediawiki: brace file handles for print for more clarity
This follows the following rule:
InputOutput::RequireBracedFileHandleWithPrint (Severity: 1)
    The `print' and `printf' functions have a unique syntax that supports an
    optional file handle argument. Conway suggests wrapping this argument in
    braces to make it visually stand out from the other arguments. When you
    put braces around any of the special package-level file handles like
    `STDOUT', `STDERR', and `DATA', you must the `'*'' sigil or else it
    won't compile under `use strict 'subs''.

      print $FH   "Mary had a little lamb\n";  #not ok
      print {$FH} "Mary had a little lamb\n";  #ok

      print   STDERR   $foo, $bar, $baz;  #not ok
      print  {STDERR}  $foo, $bar, $baz;  #won't compile under 'strict'
      print {*STDERR}  $foo, $bar, $baz;  #perfect!

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:18 -07:00
Célestin Matte 86e95ef2d4 git-remote-mediawiki: modify strings for a better coding-style
- strings which don't need interpolation are single-quoted for more clarity and
slight gain of performance
- interpolation is preferred over concatenation in many cases, for more clarity
- variables are always used with the ${} operator inside strings
- strings including double-quotes are written with qq() so that the quotes do
not have to be escaped

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:17 -07:00
Célestin Matte 6a316beeee git-remote-mediawiki: put long code into a subroutine
Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:17 -07:00
Célestin Matte 42e91929ae git-remote-mediawiki: remove import of unused open2
Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:17 -07:00
Célestin Matte ee25ff2c97 git-remote-mediawiki: check return value of open
Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:17 -07:00
Célestin Matte 4f1b7883bc git-remote-mediawiki: assign a variable as undef and make proper indentation
Explicitly assign local variable $/ as undef and make a proper
one-instruction-by-line indentation

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:17 -07:00
Célestin Matte b835baf65c git-remote-mediawiki: rename a variable ($last) which has the name of a keyword
Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:17 -07:00
Célestin Matte 3eb4ee99fb git-remote-mediawiki: remove unused variable $entry
Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:17 -07:00
Célestin Matte 267055f860 git-remote-mediawiki: turn double-negated expressions into simple expressions
Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:17 -07:00
Célestin Matte 8f04f7ddd3 git-remote-mediawiki: change the name of a variable
Local variable $url has the same name as a global variable. Changing the name
of the local variable prevents future possible misunderstanding.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:17 -07:00
Célestin Matte 8a43b36ac2 git-remote-mediawiki: add newline in the end of die() error messages
Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:16 -07:00
Célestin Matte 477d4d4235 git-remote-mediawiki: change style in a regexp
Change '[\n]' to '\n': brackets are useless here.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:16 -07:00
Célestin Matte 6b825a4622 git-remote-mediawiki: change style in a regexp
In this regexp, ' |\n' is used, whereas its equivalent '[ \n]', which is
clearer, is used elsewhere. Make the style coherent.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:16 -07:00
Célestin Matte 857f21a3c1 git-remote-mediawiki: change separator of some regexps
Use {}{} instead of /// when slashes are used inside the regexp so as not to
escape it.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:16 -07:00
Célestin Matte 1149957368 git-remote-mediawiki: change the behaviour of a split
A "split ' '" is turned into a "split / /", which changes its behaviour: the
old method matched a run of whitespaces (/\s*/), while the new one will match a
single space, which is what we want here. Indeed, in other contexts,
changing split(' ') to split(/ /) could potentially be a regression, however,
here, when parsing the output of "rev-list --parents", whose output SHA-1's are
each separated by a single space, splitting on a single space is perfectly
correct.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:16 -07:00
Célestin Matte eb96b75039 git-remote-mediawiki: remove useless regexp modifier (m)
m// and // is used randomly. It is better to use the m modifier only when
needed, e.g., when the regexp uses another separator than //.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:16 -07:00
Célestin Matte 6c2fbe25fb git-remote-mediawiki: rewrite unclear line of instructions
Subroutines' parameters should be assigned to variable before doing anything
else
Besides, existing instruction affected a variable inside a "if", which break
Git's coding style

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:16 -07:00
Célestin Matte 81f6a7a43d git-remote-mediawiki: change syntax of map calls
Put first parameter of map inside a block, for better readability.
Follow BuiltinFunctions::RequireBlockMap

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:16 -07:00
Célestin Matte 0afd29e2d3 git-remote-mediawiki: move a variable declaration at the top of the code
%basetimestamps declaration was lost in the middle of subroutines

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:16 -07:00
Célestin Matte 1aff8c627b git-remote-mediawiki: always end a subroutine with a return
Follow Subroutines::RequireFinalReturn

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:16 -07:00
Célestin Matte 6a504a3f45 git-remote-mediawiki: replace :utf8 by :encoding(UTF-8)
Follow perlcritic's InputOutput::RequireEncodingWithUTF8Layer policy

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:15 -07:00
Célestin Matte 668eec6f74 git-remote-mediawiki: move "use warnings;" before any instruction
Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:15 -07:00
Célestin Matte 05d4c7b1c4 git-remote-mediawiki: make a regexp clearer
Perl's split function takes a regex pattern argument. You can also
feed it an expression, which is then compiled into a regex at runtime.
It therefore works to pass your pattern via single quotes, but it is
much less obvious to a reader that the argument is meant to be a
regex, not a static string. Using the traditional slash-delimiters
makes this easier to read.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14 09:02:15 -07:00
Junio C Hamano 7a9cc7b064 Merge branch 'bp/mediawiki-credential'
The bridge to MediaWiki has been updated to use the credential
helper interface in Git.pm, losing its own and the original
implementation the former was based on.

* bp/mediawiki-credential:
  git-remote-mediawiki: use Git.pm functions for credentials
2013-06-14 08:46:17 -07:00
Célestin Matte 5ada868799 git-remote-mediawiki: display message when launched directly
Users may be confused when they run the perl script directly.
A good way to detect this is to check the number of parameters used to call the
script, which is never different from 2 in a normal use.
Display a proper error message to avoid any confusion.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-11 14:27:15 -07:00
Benoit Person da608b124c git-remote-mediawiki: use Git.pm functions for credentials
In 52dce6d, a new credential function was added to Git.pm, based on
git-remote-mediawiki's functions. The logical follow-up is to use
those functions in git-remote-mediawiki.

Signed-off-by: Benoit Person <benoit.person@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-05 11:15:24 -07:00
Matthieu Moy 0aa0321212 git-remote-mediawiki: better error message when HTTP(S) access fails
My use-case is an invalid SSL certificate. Pulling from the wiki with a
recent version of libwww-perl fails, and git-remote-mediawiki gave no
clue about the reason. Give the mediawiki API detailed error message, and
since it is not so informative, hint the user about an invalid SSL
certificate on https:// urls.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-29 10:00:32 -07:00
Stefano Lattarini 2582ab18e4 git-remote-mediawiki: spelling fixes
Most of these were found using Lucas De Marchi's codespell tool.
Others were pointed out by Eric Sunshine.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 12:13:05 -07:00
Matthieu Moy 9b924eee98 git-remote-mediawiki: new wiki URL in documentation
The Bibzball wiki is not maintained anymore.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-04 09:54:38 -07:00
David Aguilar ebffb3d03c contrib/mw-to-git/t/install-wiki.sh: use a lowercase "usage:" string
Make the usage string consistent with Git.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-24 21:30:18 -08:00
Matthieu Moy 1986768f9c git-remote-mediawiki: use toplevel's Makefile
This makes the Makefile simpler, while providing more features, and more
consistency (the exact same rules with the exact same configuration as
Git official commands are applied with the new version).

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-08 10:02:32 -08:00
Matthieu Moy 462d97daf6 git-remote-mediawiki: escape ", \, and LF in file names
A mediawiki page can contain, and even start with a " character, we have
to escape it when generating the fast-export stream, as well as \
character. While we're there, also escape newlines, but I don't think we
can get them from MediaWiki pages.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-11-29 11:16:33 -08:00
Matthieu Moy 9a7365cfa4 git-remote-mediawiki: replace TODO-list in comment by appropriate link
My account on Github is now used as wiki and issue tracking. This will be
more flexible than in-tree management of a TODO-list.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-03 09:13:28 -07:00
Junio C Hamano 9837911c13 Merge branch 'jk/mediawiki-credential'
* jk/mediawiki-credential:
  mw-to-git: use git-credential's URL parser
  credential: convert "url" attribute into its parsed subparts
  mw-to-git: check blank credential attributes via length
  docs/credential: minor clarity fixups
2012-07-23 20:55:33 -07:00
Jeff King 77eab053a4 mw-to-git: use git-credential's URL parser
We can just feed our URL straight to git-credential and it
will parse it for us, saving us some code.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-18 13:27:02 -07:00
Jeff King 6319a2a148 mw-to-git: check blank credential attributes via length
When writing a credential to git-credential, we omit fields
that do not have a true value. This will skip empty or
undefined fields (which we want), but will also accidentally
skip usernames or passwords which happen to have a non-true
value (e.g., "0"). Be more careful by checking for non-zero
length.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-18 13:26:53 -07:00
Matthieu Moy 2272400c93 git-remote-mediawiki: allow page names with a ':'
Traditionnally, pages named Foo:Bar are page 'Bar' in namespace 'Foo'.
However, it is also possible to call a page Foo:Bar if 'Foo' is not a
namespace. In this case, the actual name of the page is 'Foo:Bar', in the
main namespace. Since we can't tell with only the filename, query the
wiki for a namespace 'Foo' in these cases, but deal with the case where
no such namespace is found.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-17 11:53:11 -07:00
Matthieu Moy fa316e090a git-remote-mediawiki: fix incorrect test usage in test
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-17 11:51:45 -07:00
Matthieu Moy ebd5fe1c15 git-remote-mediawiki: properly deal with invalid remote revisions
Some wiki, including https://git.wiki.kernel.org/ have invalid revision
numbers (i.e. the actual revision numbers are non-contiguous). Don't die
when encountering one.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-16 12:52:40 -07:00
Matthieu Moy a393f48823 git-remote-mediawiki: show progress information when getting last remote revision
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-16 12:52:40 -07:00
Matthieu Moy f690ddfdb7 git-remote-mediawiki: show progress information when listing pages
Initial phases of push and pull with git-remote-mediawiki can be long on
a large wiki. Let the user know what's going on.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-16 12:52:40 -07:00
Matthieu Moy 5c481745fb git-remote-mediawiki: use --force when adding notes
When notes are created to record a push, it normally doesn't exist yet.
However, when a push is interrupted and then restarted, it may happen
that a commit already has notes attached, and we want to reflect the newly
created remote revision, hence use 'git notes add -f' to override the
existing one

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-16 12:52:40 -07:00
Matthieu Moy 93e92d4d7c git-remote-mediawiki: get rid of O(N^2) loop
The algorithm to find a path from the local revision to the remote one
was calling "git rev-list" and parsing its output N times. Run rev-list
only once, and fill a hashtable with the result to optimize the body of
the loop.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-16 12:52:40 -07:00
Matthieu Moy 2045e293eb git-remote-mediawiki: make mediafiles export optional
It is possible to use git-remote-mediawiki on a tree with both .mw files
and other files. Before git-remote-mediawiki learnt how to export
mediafiles, such mixed trees allowed the user to maintain both the wiki
and other files for the same project in the same repository. With the
newly added support for exporting mediafiles, pushing such mixed trees
would upload unrelated files as mediafiles, which may not be desired.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-16 12:52:40 -07:00
Matthieu Moy dcb1ea620d git-remote-mediawiki: actually send empty comment when they're empty
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-16 11:06:14 -07:00
Matthieu Moy ac4bbb41b2 git-remote-mediawiki: don't split namespaces with spaces
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-16 11:06:13 -07:00
Junio C Hamano 6a9aa0c9b2 Merge branch 'mm/mediawiki-tests'
* mm/mediawiki-tests:
  git-remote-mediawiki: be more defensive when requests fail
  git-remote-mediawiki: more efficient 'pull' in the best case
  git-remote-mediawiki: extract revision-importing loop to a function
  git-remote-mediawiki: refactor loop over revision ids
  git-remote-mediawiki: change return type of get_mw_pages
  git-remote-mediawiki (t9363): test 'File:' import and export
  git-remote-mediawiki: support for uploading file in test environment
  git-remote-mediawiki (t9362): test git-remote-mediawiki with UTF8 characters
  git-remote-mediawiki (t9361): test git-remote-mediawiki pull and push
  git-remote-mediawiki (t9360): test git-remote-mediawiki clone
  git-remote-mediawiki: test environment of git-remote-mediawiki
  git-remote-mediawiki: scripts to install, delete and clear a MediaWiki
2012-07-13 15:37:46 -07:00
Junio C Hamano 2763aa2ba3 Merge branch 'mm/mediawiki-file-attachments'
"mediawiki" remote helper (in contrib/) learned to handle file
attachments.

* mm/mediawiki-file-attachments:
  git-remote-mediawiki: improve support for non-English Wikis
  git-remote-mediawiki: import "File:" attachments
  git-remote-mediawiki: split get_mw_pages into smaller functions
  git-remote-mediawiki: send "File:" attachments to a remote wiki
  git-remote-mediawiki: don't "use encoding 'utf8';"
  git-remote-mediawiki: don't compute the diff when getting commit message
2012-07-13 15:36:53 -07:00
Matthieu Moy 2da7830d5c git-remote-mediawiki: update comments to reflect credential support
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-08 18:44:43 -07:00
Matthieu Moy ff0bfd754d git-remote-mediawiki: be more defensive when requests fail
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-06 12:20:46 -07:00
Matthieu Moy 5a29217dda git-remote-mediawiki: more efficient 'pull' in the best case
The only way to fetch new revisions from a wiki before this patch was to
query each page for new revisions. This is good when tracking a small set
of pages on a large wiki, but very inefficient when tracking many pages
on a wiki with little activity.

Implement a new strategy that queries the wiki for its last global
revision, queries each new revision, and filter out pages that are not
tracked.

Signed-off-by: Simon Perrat <simon.perrat@ensimag.imag.fr>
Signed-off-by: Simon CATHEBRAS <Simon.Cathebras@ensimag.imag.fr>
Signed-off-by: Julien KHAYAT <Julien.Khayat@ensimag.imag.fr>
Signed-off-by: Charles ROUSSEL <Charles.Roussel@ensimag.imag.fr>
Signed-off-by: Guillaume SASDY <Guillaume.Sasdy@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-06 12:20:46 -07:00
Matthieu Moy 312fa9aa12 git-remote-mediawiki: extract revision-importing loop to a function
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-06 12:20:46 -07:00
Matthieu Moy 4465b6d610 git-remote-mediawiki: refactor loop over revision ids
Without changing the behavior, we turn the foreach loop on an array of
revisions into a loop on an array of integer. It will be easier to
implement other strategies as they will only need to produce an array of
integer instead of a more complex data-structure.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-06 12:20:46 -07:00
Matthieu Moy b1ede9a9f2 git-remote-mediawiki: change return type of get_mw_pages
The previous version was returning the list of pages to be fetched, but
we are going to need an efficient membership test (i.e. is the page
$title tracked), hence exposing a hash will be more convenient.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-06 12:20:46 -07:00
NGUYEN Kim Thuat 64137fd1cf git-remote-mediawiki (t9363): test 'File:' import and export
Signed-off-by: Pavel Volek <Pavel.Volek@ensimag.imag.fr>
Signed-off-by: NGUYEN Kim Thuat <Kim-Thuat.Nguyen@ensimag.imag.fr>
Signed-off-by: ROUCHER IGLESIAS Javier <roucherj@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-06 12:20:46 -07:00
Matthieu Moy eb63bfaadf git-remote-mediawiki: support for uploading file in test environment
This will be used for testing git-remote-mediawiki's import feature on a
wiki containing media files.

Signed-off-by: Simon CATHEBRAS <Simon.Cathebras@ensimag.imag.fr>
Signed-off-by: Julien KHAYAT <Julien.Khayat@ensimag.imag.fr>
Signed-off-by: Simon Perrat <simon.perrat@ensimag.imag.fr>
Signed-off-by: Charles ROUSSEL <Charles.Roussel@ensimag.imag.fr>
Signed-off-by: Guillaume SASDY <Guillaume.Sasdy@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-06 12:20:46 -07:00
Simon Cathebras a3a96a1308 git-remote-mediawiki (t9362): test git-remote-mediawiki with UTF8 characters
Non-ascii encoding create many particular cases when used in page
content, name, and edit/commit message. Test these cases.

Signed-off-by: Simon CATHEBRAS <Simon.Cathebras@ensimag.imag.fr>
Signed-off-by: Julien KHAYAT <Julien.Khayat@ensimag.imag.fr>
Signed-off-by: Simon Perrat <simon.perrat@ensimag.imag.fr>
Signed-off-by: Charles ROUSSEL <Charles.Roussel@ensimag.imag.fr>
Signed-off-by: Guillaume SASDY <Guillaume.Sasdy@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-06 12:20:46 -07:00
Guillaume Sasdy 36840225df git-remote-mediawiki (t9361): test git-remote-mediawiki pull and push
This patch provides a set of tests for the pull and push fonctionnality
of git-remote-mediawiki. The actual tests are kept in a separate function
to allow further tests to re-run the same set of commands with different
push and pull strategies.

Signed-off-by: Simon CATHEBRAS <Simon.Cathebras@ensimag.imag.fr>
Signed-off-by: Julien KHAYAT <Julien.Khayat@ensimag.imag.fr>
Signed-off-by: Simon Perrat <simon.perrat@ensimag.imag.fr>
Signed-off-by: Charles ROUSSEL <Charles.Roussel@ensimag.imag.fr>
Signed-off-by: Guillaume SASDY <Guillaume.Sasdy@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-06 12:20:46 -07:00
Guillaume Sasdy c24ff30f96 git-remote-mediawiki (t9360): test git-remote-mediawiki clone
Signed-off-by: Simon CATHEBRAS <Simon.Cathebras@ensimag.imag.fr>
Signed-off-by: Julien KHAYAT <Julien.Khayat@ensimag.imag.fr>
Signed-off-by: Simon Perrat <simon.perrat@ensimag.imag.fr>
Signed-off-by: Charles ROUSSEL <Charles.Roussel@ensimag.imag.fr>
Signed-off-by: Guillaume SASDY <Guillaume.Sasdy@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-06 12:20:45 -07:00
Guillaume Sasdy 8435b28989 git-remote-mediawiki: test environment of git-remote-mediawiki
In order to test git-remote-mediawiki, a set of functions is needed to
manage a MediaWiki: edit a page, remove a page, fetch a page, fetch all
pages on a given wiki.

A few helper function are also provided to check the content of
directories.

In addition, this patch provides Makefiles to execute tests.
See the README file for more details.

Signed-off-by: Simon CATHEBRAS <Simon.Cathebras@ensimag.imag.fr>
Signed-off-by: Julien KHAYAT <Julien.Khayat@ensimag.imag.fr>
Signed-off-by: Simon Perrat <simon.perrat@ensimag.imag.fr>
Signed-off-by: Charles ROUSSEL <Charles.Roussel@ensimag.imag.fr>
Signed-off-by: Guillaume SASDY <Guillaume.Sasdy@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-06 12:20:45 -07:00
Guillaume Sasdy 5ef6ad1785 git-remote-mediawiki: scripts to install, delete and clear a MediaWiki
install_wiki.sh allows the user to install a MediaWiki instance in a
single shell command. Like "git instaweb", it configures and launches
lighttpd without requiring root priviledges. To simplify database
management, it uses SQLite, which doesn't require a running daemon, and
allows reseting the database by simply replacing a single file. This
allows install_wiki to also defines a function wiki_reset which clear all
content of the previously created wiki, which will be very useful to run
several indepenant tests on the same wiki.

Note those functionnalities are made to be used from the user command
line in the directory git/contrib/mw-to-git/t/

Signed-off-by: Simon CATHEBRAS <Simon.Cathebras@ensimag.imag.fr>
Signed-off-by: Julien KHAYAT <Julien.Khayat@ensimag.imag.fr>
Signed-off-by: Simon Perrat <simon.perrat@ensimag.imag.fr>
Signed-off-by: Charles ROUSSEL <Charles.Roussel@ensimag.imag.fr>
Signed-off-by: Guillaume SASDY <Guillaume.Sasdy@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-06 12:20:45 -07:00
Matthieu Moy 6df7e0df09 git-remote-mediawiki: improve support for non-English Wikis
Mediafiles can live in namespaces with names different from Image
and File. While at it, rework the code to make it simpler and easier
to read.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-04 23:59:16 -07:00
Pavel Volek 6a9e55b0fc git-remote-mediawiki: import "File:" attachments
Add the symmetrical feature to the "File:" export support in the previous
patch. Download files from the wiki as needed, and feed them into the
fast-import stream. Import both the file itself, and the corresponding
description page.

Signed-off-by: Pavel Volek <Pavel.Volek@ensimag.imag.fr>
Signed-off-by: NGUYEN Kim Thuat <Kim-Thuat.Nguyen@ensimag.imag.fr>
Signed-off-by: ROUCHER IGLESIAS Javier <roucherj@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-27 14:23:52 -07:00
Matthieu Moy 9cb74f3666 git-remote-mediawiki: split get_mw_pages into smaller functions
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-27 14:18:03 -07:00
NGUYEN Kim Thuat b3d9859598 git-remote-mediawiki: send "File:" attachments to a remote wiki
The current version of the git-remote-mediawiki supports only import and
export of plain wiki pages. This patch adds the functionality to export
file attachments (i.e. the content of the File: MediaWiki namespace),
which are also exposed by MediaWiki API.

This requires a recent version of MediaWiki::API (Version 0.37 works.
Version 0.34 doesn't).

Signed-off-by: Pavel Volek <Pavel.Volek@ensimag.imag.fr>
Signed-off-by: NGUYEN Kim Thuat <Kim-Thuat.Nguyen@ensimag.imag.fr>
Signed-off-by: ROUCHER IGLESIAS Javier <roucherj@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-27 14:18:02 -07:00
Matthieu Moy 721a533f8c git-remote-mediawiki: don't "use encoding 'utf8';"
The use of this statement is generally discouraged, and is too intrusive
for us: it forces the HTTP requests made by the API to contain only valid
UTF-8 characters. This would break the upload of binary files.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-27 14:18:02 -07:00
Matthieu Moy 28c24bd725 git-remote-mediawiki: don't compute the diff when getting commit message
While we're there, simplify the code a bit: since log --format=%s anyway
shows the subject line as a single line, no need to split to take the
first line.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-27 14:18:01 -07:00
Matthieu Moy a7271ad1dc git-remote-mediawiki: add credential support
The previous version implemented the possibility to log in a wiki, but
the username and password had to be provided as configuration variables.
We add the possibility to use the Git credential system to prompt
the password.

The support if implemented with generic functions that mimic the C API,
designed to be usable from other contexts in the future (i.e. they may
migrate to Git.pm if someone is interested).

While we're there, do a bit of refactoring in mw_connect_maybe.

Based on patch by: Javier Roucher Iglesias <Javier.Roucher-Iglesias@ensimag.imag.fr>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-25 11:56:24 -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
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
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