[MediaWiki-commits] [Gerrit] mediawiki...Translate[master]: Add a script that expands message group spec

2017-12-04 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/394067 )

Change subject: Add a script that expands message group spec
..


Add a script that expands message group spec

Specification is a comma separated list of message groups ids
which allows wildcards * and ?.

I am planning to make RepoNG to take advantage of parallelism.
In twn config we have groupspec such as mwgithub-* and RepoNG
cannot parallelize exports if it doesn't know the full list
of message groups that wildcard matches. This script provides
that.

Change-Id: I2bc6be824ccd5aa19e2ee15378150952f82e33a5
---
A scripts/expand-groupspec.php
1 file changed, 58 insertions(+), 0 deletions(-)

Approvals:
  KartikMistry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/expand-groupspec.php b/scripts/expand-groupspec.php
new file mode 100644
index 000..0c4235d
--- /dev/null
+++ b/scripts/expand-groupspec.php
@@ -0,0 +1,58 @@
+mDescription = 'Expands a message group specification.';
+   $this->addOption(
+   'exportable',
+   'List only groups that can be exported',
+   false, /*required*/
+   false /*has arg*/
+   );
+
+   $this->addArg(
+   'specification',
+   'For example page-*,main',
+   true, /*required*/
+   false /*has arg*/
+   );
+   }
+
+   public function execute() {
+   $spec = $this->getArg( 0 );
+   $patterns = explode( ',', trim( $spec ) );
+   $ids = MessageGroups::expandWildcards( $patterns );
+
+   if ( $this->getOption( 'exportable' ) ) {
+   foreach ( $ids as $index => $id ) {
+   if ( !MessageGroups::getGroup( $id ) instanceof 
FileBasedMessageGroup ) {
+   unset( $ids[ $index ] );
+   }
+   }
+   }
+
+   if ( $ids !== [] ) {
+   // This should not be affected by --quiet
+   echo implode( "\n", $ids ) . "\n";
+   }
+   }
+}
+
+$maintClass = 'TranslateExpandGroupSpec';
+require_once RUN_MAINTENANCE_IF_MAIN;

-- 
To view, visit https://gerrit.wikimedia.org/r/394067
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2bc6be824ccd5aa19e2ee15378150952f82e33a5
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit 
Gerrit-Reviewer: KartikMistry 
Gerrit-Reviewer: Nikerabbit 
Gerrit-Reviewer: Petar.petkovic 
Gerrit-Reviewer: Siebrand 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Translate[master]: Add a script that expands message group spec

2017-11-29 Thread Nikerabbit (Code Review)
Nikerabbit has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394067 )

Change subject: Add a script that expands message group spec
..

Add a script that expands message group spec

Specification is a comma separated list of message groups ids
which allows wildcards * and ?.

I am planning to make RepoNG to take advantage of parallelism.
In twn config we have groupspec such as mwgithub-* and RepoNG
cannot parallelize exports if it doesn't know the full list
of message groups that wildcard matches. This script provides
that.

Change-Id: I2bc6be824ccd5aa19e2ee15378150952f82e33a5
---
A scripts/expand-groupspec.php
1 file changed, 42 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/67/394067/1

diff --git a/scripts/expand-groupspec.php b/scripts/expand-groupspec.php
new file mode 100644
index 000..44dd36d
--- /dev/null
+++ b/scripts/expand-groupspec.php
@@ -0,0 +1,42 @@
+mDescription = 'Expands a message group specification.';
+   $this->addArg(
+   'specification',
+   'For example page-*,main',
+   true, /*required*/
+   false /*has arg*/
+   );
+   }
+
+   public function execute() {
+   $spec = $this->getArg( 0 );
+   $patterns = explode( ',', trim( $spec ) );
+   $ids = MessageGroups::expandWildcards( $patterns );
+   if ( $ids !== [] ) {
+   // This should not be affected by --quiet
+   echo implode( "\n", $ids ) . "\n";
+   }
+   }
+}
+
+$maintClass = 'TranslateExpandGroupSpec';
+require_once RUN_MAINTENANCE_IF_MAIN;

-- 
To view, visit https://gerrit.wikimedia.org/r/394067
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2bc6be824ccd5aa19e2ee15378150952f82e33a5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits