Re: [PATCH/RFC 3/4] git-mw: Adding git-mw.perl script

2013-06-24 Thread Matthieu Moy
benoit.per...@ensimag.fr writes:

 diff --git a/contrib/mw-to-git/git-mw.perl b/contrib/mw-to-git/git-mw.perl
 new file mode 100644
 index 000..a2f0aa1
 --- /dev/null
 +++ b/contrib/mw-to-git/git-mw.perl

*.perl scripts are usually executable in Git's tree (although it's
usually better to run the non-*.perl version).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH/RFC 3/4] git-mw: Adding git-mw.perl script

2013-06-24 Thread Junio C Hamano
Matthieu Moy matthieu@grenoble-inp.fr writes:

 benoit.per...@ensimag.fr writes:

 diff --git a/contrib/mw-to-git/git-mw.perl b/contrib/mw-to-git/git-mw.perl
 new file mode 100644
 index 000..a2f0aa1
 --- /dev/null
 +++ b/contrib/mw-to-git/git-mw.perl

 *.perl scripts are usually executable in Git's tree (although it's
 usually better to run the non-*.perl version).

Good eyes.  But if we encourage people to run non-*.perl version,
perhaps we should drop the executable bit from the source, no?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH/RFC 3/4] git-mw: Adding git-mw.perl script

2013-06-24 Thread Matthieu Moy
Junio C Hamano gits...@pobox.com writes:

 Matthieu Moy matthieu@grenoble-inp.fr writes:

 benoit.per...@ensimag.fr writes:

 diff --git a/contrib/mw-to-git/git-mw.perl b/contrib/mw-to-git/git-mw.perl
 new file mode 100644
 index 000..a2f0aa1
 --- /dev/null
 +++ b/contrib/mw-to-git/git-mw.perl

 *.perl scripts are usually executable in Git's tree (although it's
 usually better to run the non-*.perl version).

 Good eyes.  But if we encourage people to run non-*.perl version,
 perhaps we should drop the executable bit from the source, no?

But by default, I'd say consistency is most important so if other *.perl
are executable, we should do the same (otherwise my ls shows different
colors and it's ugly ;-) ).

But it may make sense to change the convention, i.e. run a chmod -x
*.perl in Git's tree (in any case, people can still run perl
foo.perl).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH/RFC 3/4] git-mw: Adding git-mw.perl script

2013-06-24 Thread Jeff King
On Mon, Jun 24, 2013 at 06:56:17PM +0200, Matthieu Moy wrote:

  Good eyes.  But if we encourage people to run non-*.perl version,
  perhaps we should drop the executable bit from the source, no?
 
 But by default, I'd say consistency is most important so if other *.perl
 are executable, we should do the same (otherwise my ls shows different
 colors and it's ugly ;-) ).
 
 But it may make sense to change the convention, i.e. run a chmod -x
 *.perl in Git's tree (in any case, people can still run perl
 foo.perl).

You'd probably want to also change the shell scripts, too, which are
marked executable in the repo (but the source-able shell libraries are
not).

I don't remember the details, but I think there may be some magic with
the --valgrind test option that depends on the executable bit to
distinguish those two.

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH/RFC 3/4] git-mw: Adding git-mw.perl script

2013-06-24 Thread Benoit Person

Le 2013-06-24 18:56, Matthieu Moy a écrit :

Junio C Hamano gits...@pobox.com writes:


Matthieu Moy matthieu@grenoble-inp.fr writes:


benoit.per...@ensimag.fr writes:

diff --git a/contrib/mw-to-git/git-mw.perl 
b/contrib/mw-to-git/git-mw.perl

new file mode 100644
index 000..a2f0aa1
--- /dev/null
+++ b/contrib/mw-to-git/git-mw.perl


*.perl scripts are usually executable in Git's tree (although it's
usually better to run the non-*.perl version).


Good eyes.  But if we encourage people to run non-*.perl version,
perhaps we should drop the executable bit from the source, no?


But by default, I'd say consistency is most important so if other 
*.perl
are executable, we should do the same (otherwise my ls shows 
different

colors and it's ugly ;-) ).

So it's really a *nice* catch then :) .


But it may make sense to change the convention, i.e. run a chmod -x
*.perl in Git's tree (in any case, people can still run perl
foo.perl).

For what I've seen so far of git.git, the best way would be to make it
executable in this patch serie and send another patch applying that
'chmod -x'-thingy ?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH/RFC 3/4] git-mw: Adding git-mw.perl script

2013-06-24 Thread Junio C Hamano
Matthieu Moy matthieu@grenoble-inp.fr writes:

 Junio C Hamano gits...@pobox.com writes:

 Matthieu Moy matthieu@grenoble-inp.fr writes:

 benoit.per...@ensimag.fr writes:

 diff --git a/contrib/mw-to-git/git-mw.perl b/contrib/mw-to-git/git-mw.perl
 new file mode 100644
 index 000..a2f0aa1
 --- /dev/null
 +++ b/contrib/mw-to-git/git-mw.perl

 *.perl scripts are usually executable in Git's tree (although it's
 usually better to run the non-*.perl version).

 Good eyes.  But if we encourage people to run non-*.perl version,
 perhaps we should drop the executable bit from the source, no?

 But by default, I'd say consistency is most important so if other *.perl
 are executable, we should do the same.

Ah, I should have been more clear.  I meant perhaps we should drop
executable bits from existing *.perl source files.

 But it may make sense to change the convention, i.e. run a chmod -x
 *.perl in Git's tree (in any case, people can still run perl
 foo.perl).

Yes, that is exactly what I meant.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH/RFC 3/4] git-mw: Adding git-mw.perl script

2013-06-16 Thread Matthieu Moy
Benoît Person benoit.per...@ensimag.fr writes:

 I think you need an equivalent of Git's toplevel bin-wrappers/git, or
 perhaps use the same bin-wrapper/git but let make install in
 contrib/mw-to-git/ install GitMediawiki.pm in perl/blib/lib
 Typo s/make install/make/ ?

Yes.

 For that one, I am not really sure Git::Mediawiki makes more sense
 than GitMediawiki. The point of the GitMediawiki.pm package is to
 contain all the stuff for the bidirectionnal-thingy. So they are not
 really Git-related, nor Mediawiki-related.

I'd say they are related to both, not to neither.

 Making it part of a Git directory / namespace does not really feels
 right, even if it's how it's done for SVN :/ .

Well, it's the part of Git's perl library which deals with SVN
interaction, so it makes sense to have it be a subdirectory of Git. I'd
say it makes as much sense for Mediawiki interaction.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH/RFC 3/4] git-mw: Adding git-mw.perl script

2013-06-15 Thread Benoît Person
The V3 is ready, but I am still not sure about what is the best way to
do it for this issue though.

On 13 June 2013 15:01, Matthieu Moy matthieu@grenoble-inp.fr wrote:
 benoit.per...@ensimag.fr writes:
 How does the make Vs make install work? How does a developer run the
 tool without installing?
Well it does not work without installing but I think you know that now :)

 I first tried:

 $ ../../bin-wrappers/git mw
 git: 'mw' is not a git command. See 'git --help'.

 Then, this first seem OK:

 $ ./git-mw
 usage: git mw command args

 git mw commands are:
 HelpDisplay help information about git mw
 Preview Parse and render local file into HTML

 BUT, this will take the installed GitMediawiki.pm if it is available,
 and we don't want this (if one hacks GitMediawiki.pm locally, one wants
 the new hacked to be taken into account without make installing it).

 To understand better how it works, try adding this in git-mw.perl:

   print $_\n for @INC;

 I get this:

 /home/moy/local/usr-squeeze/share/perl/5.14.2
 /home/moy/local/usr-squeeze/src/MediaWiki-API-0.39/blib/lib
 /etc/perl
 /usr/local/lib/perl/5.14.2
 /usr/local/share/perl/5.14.2
 /usr/lib/perl5
 /usr/share/perl5
 /usr/lib/perl/5.14
 /usr/share/perl/5.14
 /usr/local/lib/site_perl
 .

 The '.' is there, but it comes after the hardcoded
 /home/moy/local/usr-squeeze/share/perl/5.14.2 (which has to comes first,
 to let the install version be robust to whatever comes after).
Thanks for the explanations

 I think you need an equivalent of Git's toplevel bin-wrappers/git, or
 perhaps use the same bin-wrapper/git but let make install in
 contrib/mw-to-git/ install GitMediawiki.pm in perl/blib/lib
Typo s/make install/make/ ?

For now, I have implemented that one : each time you do `make`, if
there is changes in GitMediawiki.pm, it gets copied to $GITPERLLIB
(perl/blib/lib). But I am not sure it's the best approach here. If we
want something entirely self-contained for GitMediawiki, creating a
new git wrapper seems like the best way. But then, we could say that
since GitMediawiki Makefile uses Git toplevel Makefile, it's not
entirely self-contained :/ maybe it's the copying file that makes it
weird ?

 BTW, I just noticed we had a Git::SVN, so perhaps GitMediawiki should be
 Git::MediaWiki.
For that one, I am not really sure Git::Mediawiki makes more sense
than GitMediawiki. The point of the GitMediawiki.pm package is to
contain all the stuff for the bidirectionnal-thingy. So they are not
really Git-related, nor Mediawiki-related. Making it part of a Git
directory / namespace does not really feels right, even if it's how
it's done for SVN :/ .

Thank you for the all the reviews, (it works for Ensiwiki now \o/)

Benoit Person
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH/RFC 3/4] git-mw: Adding git-mw.perl script

2013-06-13 Thread benoit . person
From: Benoit Person benoit.per...@ensimag.fr

This script will be used for all tools and command related to a mediawiki
remote. In this commit we introduce the tool, the way it parses argument
and subcommands and an example of subcommand: help. It also updates
the Makefile so that the new tool is installed properly.

Signed-off-by: Benoit Person benoit.per...@ensimag.fr
Signed-off-by: Matthieu Moy matthieu@grenoble-inp.fr

---
 contrib/mw-to-git/Makefile|  7 ---
 contrib/mw-to-git/git-mw.perl | 46 +++
 2 files changed, 50 insertions(+), 3 deletions(-)
 create mode 100644 contrib/mw-to-git/git-mw.perl

diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
index fe30e7f..c0633b1 100644
--- a/contrib/mw-to-git/Makefile
+++ b/contrib/mw-to-git/Makefile
@@ -6,6 +6,7 @@
 
 GIT_MEDIAWIKI_PM=GitMediawiki.pm
 SCRIPT_PERL=git-remote-mediawiki.perl
+SCRIPT_PERL+=git-mw.perl
 GIT_ROOT_DIR=../..
 HERE=contrib/mw-to-git/
 
@@ -19,14 +20,14 @@ install_pm:
cp $(GIT_MEDIAWIKI_PM) $(INSTLIBDIR)
 
 build:
-   $(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
+   $(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
 build-perl-script
 
 install: install_pm
-   $(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
+   $(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
 install-perl-script
 
 clean:
-   $(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
+   $(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
 clean-perl-script
rm $(INSTLIBDIR)/$(GIT_MEDIAWIKI_PM)
\ No newline at end of file
diff --git a/contrib/mw-to-git/git-mw.perl b/contrib/mw-to-git/git-mw.perl
new file mode 100644
index 000..a2f0aa1
--- /dev/null
+++ b/contrib/mw-to-git/git-mw.perl
@@ -0,0 +1,46 @@
+#!/usr/bin/perl
+
+# Copyright (C) 2013
+# Benoit Person benoit.per...@ensimag.imag.fr
+# Celestin Matte celestin.ma...@ensimag.imag.fr
+# License: GPL v2 or later
+
+# Set of tools for git repo with a mediawiki remote.
+# Documentation  bugtracker: https://github.com/moy/Git-Mediawiki/
+
+use strict;
+use warnings;
+
+use Getopt::Long;
+
+my %commands = (
+   'help' =
+   [\help, {}, \help]
+);
+
+# Search for sub-command
+my $cmd = $commands{'help'};
+for (my $i = 0; $i  @ARGV; $i++) {
+   if (defined $commands{$ARGV[$i]}) {
+   $cmd = $commands{$ARGV[$i]};
+   splice @ARGV, $i, 1;
+   last;
+   }
+};
+GetOptions( %{$cmd-[1]},
+   'help|h' = \{$cmd-[2]});
+
+# Launch command
+{$cmd-[0]};
+
+## Help Functions 
##
+
+sub help {
+   print 'END';
+usage: git mw command args
+
+git mw commands are:
+HelpDisplay help information about git mw
+END
+   exit;
+}
\ No newline at end of file
-- 
1.8.3.GIT

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH/RFC 3/4] git-mw: Adding git-mw.perl script

2013-06-13 Thread Matthieu Moy
benoit.per...@ensimag.fr writes:

 From: Benoit Person benoit.per...@ensimag.fr

 This script will be used for all tools and command related to a mediawiki
 remote. In this commit we introduce the tool, the way it parses argument
 and subcommands and an example of subcommand: help. It also updates
 the Makefile so that the new tool is installed properly.

How does the make Vs make install work? How does a developer run the
tool without installing?

I first tried:

$ ../../bin-wrappers/git mw
git: 'mw' is not a git command. See 'git --help'.

Then, this first seem OK:

$ ./git-mw 
usage: git mw command args

git mw commands are:
HelpDisplay help information about git mw
Preview Parse and render local file into HTML

BUT, this will take the installed GitMediawiki.pm if it is available,
and we don't want this (if one hacks GitMediawiki.pm locally, one wants
the new hacked to be taken into account without make installing it).

To understand better how it works, try adding this in git-mw.perl:

  print $_\n for @INC;

I get this:

/home/moy/local/usr-squeeze/share/perl/5.14.2
/home/moy/local/usr-squeeze/src/MediaWiki-API-0.39/blib/lib
/etc/perl
/usr/local/lib/perl/5.14.2
/usr/local/share/perl/5.14.2
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.14
/usr/share/perl/5.14
/usr/local/lib/site_perl
.

The '.' is there, but it comes after the hardcoded
/home/moy/local/usr-squeeze/share/perl/5.14.2 (which has to comes first,
to let the install version be robust to whatever comes after).

I think you need an equivalent of Git's toplevel bin-wrappers/git, or
perhaps use the same bin-wrapper/git but let make install in
contrib/mw-to-git/ install GitMediawiki.pm in perl/blib/lib

BTW, I just noticed we had a Git::SVN, so perhaps GitMediawiki should be
Git::MediaWiki.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html