Nikerabbit has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/381758 )

Change subject: RepoNG: Support subversion
......................................................................

RepoNG: Support subversion

Converted our two subversion projects NOCC and FUDForum to RepoNG.

Change-Id: I818fa86e1ec16c9d2691f5a41f1f2069ee4298c1
---
M REPOCONF
M REPOCONF.commit
M bin/REPONG-PROJECTS
A bin/clupdate-svn-repo
M bin/repocommit
M bin/repocreate
M bin/repoexport
M bin/repoupdate
M repoconfig.commit.json
M repoconfig.json
M repong/repong.php
11 files changed, 82 insertions(+), 61 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/translatewiki 
refs/changes/58/381758/1

diff --git a/REPOCONF b/REPOCONF
index 40953b7..b1f4826 100644
--- a/REPOCONF
+++ b/REPOCONF
@@ -4,8 +4,6 @@
 REPO_MWEXTGIT=https://gerrit.wikimedia.org/r/p/mediawiki/extensions
 REPO_MWSKINGIT=https://gerrit.wikimedia.org/r/p/mediawiki/skins
 
-REPO_FUDFORUM=svn://svn.code.sf.net/p/fudforum/code/trunk/install/forum_data/thm/default/i18n
 REPO_IHRIS=http://bazaar.launchpad.net/~intrahealth%2Binformatics
 REPO_IHRIS_BRANCH="4.2-dev"
 REPO_IHRIS_MODULES="i2ce ihris-common ihris-manage ihris-qualify ihris-train"
-REPO_NOCC=https://svn.code.sf.net/p/nocc/code/trunk
diff --git a/REPOCONF.commit b/REPOCONF.commit
index 5f45d1f..6229e2c 100644
--- a/REPOCONF.commit
+++ b/REPOCONF.commit
@@ -1,20 +1,11 @@
 # If REPO_RW=yes, will set up commit stuff
 REPO_RW=yes
 
-# Fix Niklas's internal to external username
-if [ "$USER" == "nike" ]; then
-       THISUSER="nikerabbit"
-else
-       THISUSER="$USER"
-fi
-
 # MediaWiki
 REPO_MWEXTGIT=ssh://[email protected]:29418/mediawiki/extensions
 REPO_MWSKINGIT=ssh://[email protected]:29418/mediawiki/skins
 
 # other
-REPO_FUDFORUM=svn+ssh://${THISUSER}@svn.code.sf.net/p/fudforum/code/trunk/install/forum_data/thm/default/i18n
 REPO_IHRIS=http://bazaar.launchpad.net/~intrahealth%2Binformatics
 REPO_IHRIS_BRANCH="4.2"
 REPO_IHRIS_MODULES="i2ce ihris-common ihris-manage ihris-qualify ihris-train"
-REPO_NOCC=svn+ssh://${THISUSER}@svn.code.sf.net/p/nocc/code/trunk
diff --git a/bin/REPONG-PROJECTS b/bin/REPONG-PROJECTS
index 52dff0b..0d2a110 100644
--- a/bin/REPONG-PROJECTS
+++ b/bin/REPONG-PROJECTS
@@ -7,6 +7,7 @@
 eol
 etherpad-lite
 freecol
+fudforum
 gapfinder
 hivejs
 huggle
@@ -25,6 +26,7 @@
 mwgerrit
 mwgithub
 nfcring-control
+nocc
 oppia
 osm
 pageviews
diff --git a/bin/clupdate-svn-repo b/bin/clupdate-svn-repo
new file mode 100755
index 0000000..109e041
--- /dev/null
+++ b/bin/clupdate-svn-repo
@@ -0,0 +1,14 @@
+#!/bin/bash
+set -e
+set -u
+
+URL=$1
+DIR=$2
+
+if [ -d "$DIR/.svn" ]
+then
+       cd "$DIR"
+       svn up -q "$DIR"
+else
+       svn checkout -q "$URL" "$DIR"
+fi
diff --git a/bin/repocommit b/bin/repocommit
index 7e3a73c..ab890b4 100755
--- a/bin/repocommit
+++ b/bin/repocommit
@@ -36,18 +36,7 @@
        fi
 done
 
-if [ "$PROJECT" = "fudforum" ]
-then
-       cd "$DIR/$PROJECT"
-       svn add -q --force *
-       for i in `find . -name msg`
-       do
-               svn propset -q svn:mime-type text/plain $i
-               svn propset -q svn:eol-style native $i
-       done
-       svn commit --message "$COMMITMSG"
-
-elif [ "$PROJECT" = "ihris" ]
+if [ "$PROJECT" = "ihris" ]
 then
        for MODULE in $REPO_IHRIS_MODULES
        do
@@ -73,12 +62,6 @@
                gitCommitGerrit "$DIR/$PROJECT/$i"
                "$DIRSCRIPT/merge-wmgerrit-patches" "mediawiki/skins/$i"
        done
-
-elif [ "$PROJECT" = "nocc" ]
-then
-       cd "$DIR/$PROJECT"
-       svn add --force * --auto-props --parents --depth infinity -q
-       svn commit --message "$COMMITMSG"
 
 else
        echo "`basename $0`: Unknown project"
diff --git a/bin/repocreate b/bin/repocreate
index 0461021..9552432 100755
--- a/bin/repocreate
+++ b/bin/repocreate
@@ -19,12 +19,7 @@
        fi
 }
 
-if [ "$PROJECT" = "fudforum" ]
-then
-       checkVar 'REPO_FUDFORUM'
-       svn checkout "$REPO_FUDFORUM" $PROJECT
-
-elif [ "$PROJECT" = "ihris" ]
+if [ "$PROJECT" = "ihris" ]
 then
        checkVar 'REPO_IHRIS_MODULES'
        mkdir $PROJECT
@@ -50,11 +45,6 @@
 elif [ "$PROJECT" = "mediawiki-skins" ]
 then
        mkdir -p $PROJECT
-
-elif [ "$PROJECT" = "nocc" ]
-then
-       checkVar 'REPO_NOCC'
-       svn checkout "$REPO_NOCC" $PROJECT
 
 else
        echo "`basename $0`: Unknown project"
diff --git a/bin/repoexport b/bin/repoexport
index 33075c6..bce336a 100755
--- a/bin/repoexport
+++ b/bin/repoexport
@@ -27,11 +27,7 @@
        fi
 done
 
-if [ "$PROJECT" = "fudforum" ]
-then
-       php "$EXPORTER" --target . --group=out-fudforum --lang='*' --skip en 
$THRESHOLD
-
-elif [ "$PROJECT" = "ihris" ]
+if [ "$PROJECT" = "ihris" ]
 then
        php "$EXPORTER" --target . --group=out-ihris* --lang='*' --skip en,qqq 
$THRESHOLD --ppgettext=/resources/projects
 
@@ -56,11 +52,6 @@
            mediawiki-skin-y mediawiki-skin-z"
 
        echo $PREFIXES | xargs -n1 -P4 ${DIRSCRIPT}/export-by-prefix $DIR 
$PROJECT .
-
-elif [ "$PROJECT" = "nocc" ]
-then
-       php "$EXPORTER" --target . --group=out-nocc-* --lang='*' --skip en,qqq 
$THRESHOLD
-       php "$EXPORTER" --target . --group=out-nocc-* --lang qqq
 
 else
        echo "`basename $0`: Unknown project"
diff --git a/bin/repoupdate b/bin/repoupdate
index 40fa196..f4dc17a 100755
--- a/bin/repoupdate
+++ b/bin/repoupdate
@@ -53,11 +53,7 @@
        fi
 done
 
-if [ "$PROJECT" = "fudforum" ]
-then
-       svn up -q "$PROJECT"
-
-elif [ "$PROJECT" = "ihris" ]
+if [ "$PROJECT" = "ihris" ]
 then
        cd "$PROJECT" || exit
        for MODULE in $REPO_IHRIS_MODULES
@@ -74,10 +70,6 @@
        checkVar 'REPO_MWSKINGIT'
        fetchReposFromGerrit mediawiki/skins/ |
                xargs -P4 -I___ "$CLUPDATE_GERRIT" "$REPO_MWSKINGIT/___.git" 
"$DIR/$PROJECT/___"
-
-elif [ "$PROJECT" = "nocc" ]
-then
-       svn up -q "$PROJECT"
 
 else
        echo "$(basename "$0"): Unknown project"
diff --git a/repoconfig.commit.json b/repoconfig.commit.json
index 7f42e82..59571fa 100644
--- a/repoconfig.commit.json
+++ b/repoconfig.commit.json
@@ -159,6 +159,16 @@
                        }
                }
        },
+       "fudforum": {
+               "group": "out-fudforum",
+               "repos": {
+                       "fudforum": {
+                               "type": "svn",
+                               "url": 
"svn+ssh://[email protected]/p/fudforum/code/trunk/install/forum_data/thm/default/i18n",
+                               "svn-add-options": 
"config:auto-props:msg=svn:mime-type=text/plain;svn:eol-style=native"
+                       }
+               }
+       },
        "gapfinder": {
                "group": "gapfinder",
                "repos": {
@@ -288,6 +298,15 @@
                        }
                }
        },
+       "nocc": {
+               "group": "out-nocc-*",
+               "repos": {
+                       "nocc": {
+                               "type": "svn",
+                               "url": 
"svn+ssh://[email protected]/p/nocc/code/trunk"
+                       }
+               }
+       },
        "oppia": {
                "group": "oppia",
                "repos": {
diff --git a/repoconfig.json b/repoconfig.json
index c55294c..6773f90 100644
--- a/repoconfig.json
+++ b/repoconfig.json
@@ -159,6 +159,15 @@
                        }
                }
        },
+       "fudforum": {
+               "group": "out-fudforum",
+               "repos": {
+                       "fudforum": {
+                               "type": "svn",
+                               "url": 
"svn://svn.code.sf.net/p/fudforum/code/trunk/install/forum_data/thm/default/i18n"
+                       }
+               }
+       },
        "gapfinder": {
                "group": "gapfinder",
                "repos": {
@@ -288,6 +297,15 @@
                        }
                }
        },
+       "nocc": {
+               "group": "out-nocc-*",
+               "repos": {
+                       "nocc": {
+                               "type": "svn",
+                               "url": 
"https://svn.code.sf.net/p/nocc/code/trunk";
+                       }
+               }
+       },
        "oppia": {
                "group": "oppia",
                "repos": {
diff --git a/repong/repong.php b/repong/repong.php
index 94aef24..77be415 100644
--- a/repong/repong.php
+++ b/repong/repong.php
@@ -105,6 +105,16 @@
                                $command = "$bindir/clupdate-github-repo 
'{$repo['url']}' '$base/$name' '$branch'";
                        } elseif ( $type === 'wmgerrit' ) {
                                $command = "$bindir/clupdate-gerrit-repo 
'{$repo['url']}' '$base/$name' '$branch'";
+                       } elseif ( $type === 'svn' ) {
+                               $userName = get_current_user();
+                               if ( isset( 
$this->usernameConversion[$userName] ) ) {
+                                       $userName = 
$this->usernameConversion[$userName];
+                               }
+
+                               $repoUrl = $repo['url'];
+                               $repoUrl = str_replace( 'USERNAME', $userName, 
$repoUrl );
+
+                               $command = "$bindir/clupdate-svn-repo 
'$repoUrl' '$base/$name'";
                        } else {
                                throw new RuntimeException( 'Unknown repo type' 
);
                        }
@@ -203,13 +213,26 @@
                                $dir = "$base/$name";
                                $branch = isset( $repo['branch'] ) ? 
$repo['branch'] : 'master';
                                $command =
-                                       "cd $dir; git add .; if ! git diff 
--cached --quiet; " .
+                                       "cd '$dir'; git add .; if ! git diff 
--cached --quiet; " .
                                        "then git commit -m '$message'; git 
push origin '$branch'; fi";
                        } elseif ( $repo['type'] === 'wmgerrit' ) {
                                $dir = "$base/$name";
                                $command =
-                                       "cd $dir; git add .; if ! git diff 
--cached --quiet; " .
+                                       "cd '$dir'; git add .; if ! git diff 
--cached --quiet; " .
                                        "then git commit -m '$message'; git 
review -r origin -t L10n; fi";
+                       } elseif ( $repo['type'] === 'svn' ) {
+                               $dir = "$base/$name";
+                               $extra = '';
+                               if ( isset( $repo['svn-add-options'] ) ) {
+                                       foreach ( 
(array)$repo['svn-add-options'] as $option ) {
+                                               $extra .= " --config-option 
'$option'";
+                                       }
+                               }
+
+                               $command =
+                                       "cd '$dir'; " .
+                                       "svn add --force * --auto-props 
--parents --depth infinity -q$extra; " .
+                                       "svn commit --message '$message'";
                        } else {
                                throw new RuntimeException( 'Unknown repo type' 
);
                        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I818fa86e1ec16c9d2691f5a41f1f2069ee4298c1
Gerrit-PatchSet: 1
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to