Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-remote-mediawiki: extract revision-importing loop to a function
author
Matthieu Moy
<Matthieu.Moy@imag.fr>
Fri, 6 Jul 2012 10:03:13 +0000
(12:03 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 6 Jul 2012 19:20:46 +0000
(12:20 -0700)
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/mw-to-git/git-remote-mediawiki
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
4465b6d
)
diff --git
a/contrib/mw-to-git/git-remote-mediawiki
b/contrib/mw-to-git/git-remote-mediawiki
index 47dd574dd0dfbb363f74dbd18b2d59526da80558..930520454e75404b94395aed3bf211327d087174 100755
(executable)
--- a/
contrib/mw-to-git/git-remote-mediawiki
+++ b/
contrib/mw-to-git/git-remote-mediawiki
@@
-822,10
+822,18
@@
sub mw_import_ref {
@revisions = sort {$a->{revid} <=> $b->{revid}} @revisions;
my @revision_ids = map $_->{revid}, @revisions;
@revisions = sort {$a->{revid} <=> $b->{revid}} @revisions;
my @revision_ids = map $_->{revid}, @revisions;
- $n = 0;
+ return mw_import_revids($fetch_from, \@revision_ids, \%pages_hash);
+}
+
+sub mw_import_revids {
+ my $fetch_from = shift;
+ my $revision_ids = shift;
+ my $pages = shift;
+
+ my $n = 0;
my $last_timestamp = 0; # Placeholer in case $rev->timestamp is undefined
my $last_timestamp = 0; # Placeholer in case $rev->timestamp is undefined
- foreach my $pagerevid (@revision_ids) {
+ foreach my $pagerevid (@
$
revision_ids) {
# fetch the content of the pages
my $query = {
action => 'query',
# fetch the content of the pages
my $query = {
action => 'query',
@@
-866,7
+874,7
@@
sub mw_import_ref {
# If this is a revision of the media page for new version
# of a file do one common commit for both file and media page.
# Else do commit only for that page.
# If this is a revision of the media page for new version
# of a file do one common commit for both file and media page.
# Else do commit only for that page.
- print STDERR "$n/", scalar(@revision_ids), ": Revision #$rev->{revid} of $commit{title}\n";
+ print STDERR "$n/", scalar(@
$
revision_ids), ": Revision #$rev->{revid} of $commit{title}\n";
import_file_revision(\%commit, ($fetch_from == 1), $n, \%mediafile);
}
import_file_revision(\%commit, ($fetch_from == 1), $n, \%mediafile);
}
@@
-876,6
+884,8
@@
sub mw_import_ref {
# thrown saying that HEAD is refering to unknown object 0000000000000000000
# and the clone fails.
}
# thrown saying that HEAD is refering to unknown object 0000000000000000000
# and the clone fails.
}
+
+ return $n;
}
sub error_non_fast_forward {
}
sub error_non_fast_forward {