-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for fetching namespaces #10
Comments
I'd love to see support for fetching templates and talk pages... two big features of mediawiki that I use extensively. For me, just fetching content from the default namespace (regular articles) is not a good clone of my mediawiki. |
This should be rather straightforward to add, as the code internally works with namespaces already. I won't have time to implement it myself any time soon though. |
Would be very convenient to have a possibility to work with SemanticForms' namespaces (Template, Form, Property...) because it is pain to work with them thru web interface.. |
Well, I managed to make a patch which seems to work. It allows the user to explicitly add some categories and force them to load during repository initializing. |
Git-Mediawiki is part of Git, so you should submit patches to the Git Read this before: |
@MarSoft , can you share the patch? In a gist or a link to the submission to git? I need this too I can help test and fix some things if necesecary. |
@MarSoft I would be really interested in the patch too, and could help cleaning it up for integration! |
Just as a note, it's important that different namespaces can contain identically named pages... so probably subdirs of the checkout would be appropriate... |
Hello. Just found that patch on my computer. Posted it here: https://gist.github.com/MarSoft/ca00cecbd9d426d9e614 |
Hi guys. Just want to ask: was it implemented? |
Here´s a patch. My git may or may not be in sync with upstream. So the patch may or may not apply directly, but I think you will get the drift of it. |
@kyv, thank you, it's working. |
@kyv: to integrate the patch, you need to follow the normal procedure to contribute to Git. See here: https://github.com/git/git/blob/master/Documentation/SubmittingPatches Please, Cc: me when you send your patch. Thanks, |
@moy, I no longer use git-mediawiki, so do not have much interest in going through the procedure. I just put it there to be helpful. |
Submitting code to Git is fun, you should do it ;-). More seriously, if you agree with Git's Developer's Certificate of Origin 1.1, can you add your Sign-off-by: to your patch (see https://github.com/git/git/blob/master/Documentation/SubmittingPatches#L234). This way, someone else (possibly me when I get time) can submit your code. Thanks, |
Ok I´ll do that later then. |
@moy, I created a new patch. I signed off on this one. I also generated agains current master and squashed together what previously appeared as two commits in one. |
@kyv that's great! can you send the patch to the mailing list? i believe you need to send it to git@vger.kernel.org |
oh, and it seems that "all pages" doesn't actually fetch from all namespaces with that fix, it seems that it's an improvement that could be done on the patch. indentation also seems to be a little off. |
finally, trying the modified version, i get this when trying to specify a namespace:
|
There seems to be a problem with the patch, running it vanilla gave me:
to:
seems to make things work. With that change in place, the way namespaces are split up would also need adapting, as namespaces frequently contain spaces and splitting is currently done by space or newline (e.g. it fails with "File talk"):
|
@Grumbel i updated the patch in https://gist.github.com/anarcat/f821fa285c6b8b6b16a5 but i am not sure i covered all the changes you described, could you clarify how the last change is done? then we do need someone to carry this to the git mailing list... |
I just did it the quick and dirty way and replace the space in the regex with a comma:
to:
That was enough to make it work for my uses, but I don't know what the valid characters for namespaces are and comma might be one of them, so there might be a better way to handle the splitting. |
hmm... the documentation in the file there says:
so it seems to me that the space-separated idea should stay... besides it would break every other config out there... |
also, re-reading https://github.com/git/git/blob/master/Documentation/SubmittingPatches - we will need unit tests before this gets merged in, unfortunately. |
The issue is that with the current code you can't checkout namespaces that have spaces in them:
will make it look for
will complain about
A fix for this would be to take the namespaces in the
|
Patch added to Gentoo git patchset (even if it's not perfect yet :) ) |
Thank you for implementing this feature :) What is the recommended way to clone some user namespaces + the main namespace? |
hi all started looking into this again, and got tired of the gisting... i published a branch on my fork here: https://github.com/anarcat/git/tree/mediawiki-namespaces which tries to merge in the patches from @kyv, @Grumbel and my own, along with a way to fetch the "main" namespace, an idea suggested by @johannesloetzsch but i used a slightly different approach: anarcat/git@17e1d97 with my approach, you specify "(Main)" as normal in the list of namespaces and it's simply treated differently in the namespace processor (because, dumbly, the MW API doesn't know how to translate that name). i used "(Main)" instead of "MAIN" because that is the name used in the documentation. i seem able to fetch a full wiki with all namespaces with that approach. and honestly, i think that should just be the default already - but that's another patch... there's a hint of how that could be done in anarcat/git@a624e45#diff-d1ae99a08192b4b3e5ad8570fdb59aa0R1337 - as soon as we fetched the namespace/id mapping, we know all the namespaces and we could just use that as a default. but meh. at this point, it's easier to just copy-paste the list... |
i have also sent a modified patch series to the mailing list, in the hope of getting more traction on this: hopefully, we'll finally get this somewhere! |
i believe this was merged to git master, so this can be closed. |
On a wiki where MediaWiki:Sidebar does not start with rev 1: $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 0 revision(s). You appear to have cloned an empty MediaWiki. fatal: could not read ref refs/mediawiki/origin/master After this patch $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 115 revision(s). Namespace MediaWiki not found in cache, querying the wiki ... 1/115: Revision Git-Mediawiki#7 of MediaWiki:Sidebar 2/115: Revision Git-Mediawiki#8 of MediaWiki:Sidebar 3/115: Revision Git-Mediawiki#9 of MediaWiki:Sidebar 4/115: Revision Git-Mediawiki#10 of MediaWiki:Sidebar 5/115: Revision Git-Mediawiki#11 of MediaWiki:Sidebar 6/115: Revision Git-Mediawiki#12 of MediaWiki:Sidebar Fixes Git-Mediawiki#70
On a wiki where MediaWiki:Sidebar does not start with rev 1: $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 0 revision(s). You appear to have cloned an empty MediaWiki. fatal: could not read ref refs/mediawiki/origin/master After this patch $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 115 revision(s). Namespace MediaWiki not found in cache, querying the wiki ... 1/115: Revision Git-Mediawiki#7 of MediaWiki:Sidebar 2/115: Revision Git-Mediawiki#8 of MediaWiki:Sidebar 3/115: Revision Git-Mediawiki#9 of MediaWiki:Sidebar 4/115: Revision Git-Mediawiki#10 of MediaWiki:Sidebar 5/115: Revision Git-Mediawiki#11 of MediaWiki:Sidebar 6/115: Revision Git-Mediawiki#12 of MediaWiki:Sidebar Fixes Git-Mediawiki#70
On a wiki where MediaWiki:Sidebar does not start with rev 1: $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 0 revision(s). You appear to have cloned an empty MediaWiki. fatal: could not read ref refs/mediawiki/origin/master After this patch $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 115 revision(s). Namespace MediaWiki not found in cache, querying the wiki ... 1/115: Revision Git-Mediawiki#7 of MediaWiki:Sidebar 2/115: Revision Git-Mediawiki#8 of MediaWiki:Sidebar 3/115: Revision Git-Mediawiki#9 of MediaWiki:Sidebar 4/115: Revision Git-Mediawiki#10 of MediaWiki:Sidebar 5/115: Revision Git-Mediawiki#11 of MediaWiki:Sidebar 6/115: Revision Git-Mediawiki#12 of MediaWiki:Sidebar Fixes Git-Mediawiki#70
On a wiki where MediaWiki:Sidebar does not start with rev 1: $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 0 revision(s). You appear to have cloned an empty MediaWiki. fatal: could not read ref refs/mediawiki/origin/master After this patch $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 115 revision(s). Namespace MediaWiki not found in cache, querying the wiki ... 1/115: Revision Git-Mediawiki#7 of MediaWiki:Sidebar 2/115: Revision Git-Mediawiki#8 of MediaWiki:Sidebar 3/115: Revision Git-Mediawiki#9 of MediaWiki:Sidebar 4/115: Revision Git-Mediawiki#10 of MediaWiki:Sidebar 5/115: Revision Git-Mediawiki#11 of MediaWiki:Sidebar 6/115: Revision Git-Mediawiki#12 of MediaWiki:Sidebar Fixes Git-Mediawiki#70
On a wiki where MediaWiki:Sidebar does not start with rev 1: $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 0 revision(s). You appear to have cloned an empty MediaWiki. fatal: could not read ref refs/mediawiki/origin/master After this patch $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 115 revision(s). Namespace MediaWiki not found in cache, querying the wiki ... 1/115: Revision Git-Mediawiki#7 of MediaWiki:Sidebar 2/115: Revision Git-Mediawiki#8 of MediaWiki:Sidebar 3/115: Revision Git-Mediawiki#9 of MediaWiki:Sidebar 4/115: Revision Git-Mediawiki#10 of MediaWiki:Sidebar 5/115: Revision Git-Mediawiki#11 of MediaWiki:Sidebar 6/115: Revision Git-Mediawiki#12 of MediaWiki:Sidebar Fixes Git-Mediawiki#70
On a wiki where MediaWiki:Sidebar does not start with rev 1: $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 0 revision(s). You appear to have cloned an empty MediaWiki. fatal: could not read ref refs/mediawiki/origin/master After this patch $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 115 revision(s). Namespace MediaWiki not found in cache, querying the wiki ... 1/115: Revision Git-Mediawiki#7 of MediaWiki:Sidebar 2/115: Revision Git-Mediawiki#8 of MediaWiki:Sidebar 3/115: Revision Git-Mediawiki#9 of MediaWiki:Sidebar 4/115: Revision Git-Mediawiki#10 of MediaWiki:Sidebar 5/115: Revision Git-Mediawiki#11 of MediaWiki:Sidebar 6/115: Revision Git-Mediawiki#12 of MediaWiki:Sidebar Fixes Git-Mediawiki#70
On a wiki where MediaWiki:Sidebar does not start with rev 1: $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 0 revision(s). You appear to have cloned an empty MediaWiki. fatal: could not read ref refs/mediawiki/origin/master After this patch $ git clone -c remote.origin.pages=MediaWiki:Sidebar mediawiki::https://www.wiki.org/w/ … page 1/1: MediaWiki:Sidebar Found 115 revision(s). Namespace MediaWiki not found in cache, querying the wiki ... 1/115: Revision #7 of MediaWiki:Sidebar 2/115: Revision #8 of MediaWiki:Sidebar 3/115: Revision #9 of MediaWiki:Sidebar 4/115: Revision #10 of MediaWiki:Sidebar 5/115: Revision #11 of MediaWiki:Sidebar 6/115: Revision #12 of MediaWiki:Sidebar Fixes #70
We currently fetch the main namespace by default, and the File: namespace if mediaimport is true, but we don't fetch e.g. the Template: or discussion namespaces.
The text was updated successfully, but these errors were encountered: