[MediaWiki-commits] [Gerrit] Fix branched sub-submodule support - change (mediawiki...release)

2015-03-13 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Fix branched sub-submodule support
..


Fix branched sub-submodule support

make-wmf-branch didn't properly commit and push the branched
sub-submodules (currently used by lib/ve in visual editor extension)
Now it updates the remote url to use ssh and pushes the new branch
pointer.

Change-Id: Ia31a9f1d849ddf41bf3a31e9cb4505e58b4e57e4
---
M make-wmf-branch/MakeWmfBranch.php
1 file changed, 16 insertions(+), 5 deletions(-)

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



diff --git a/make-wmf-branch/MakeWmfBranch.php 
b/make-wmf-branch/MakeWmfBranch.php
index e1863c3..661b012 100644
--- a/make-wmf-branch/MakeWmfBranch.php
+++ b/make-wmf-branch/MakeWmfBranch.php
@@ -100,13 +100,20 @@
$this-chdir( $this-buildDir );
}
 
-   function createBranch( $branchName ) {
+   function createBranch( $branchName, $doPush=true ) {
$this-runCmd( 'git', 'checkout', '-q', '-b', $branchName );
 
$this-fixGitReview();
$this-runWriteCmd( 'git', 'commit', '-a', '-q', '-m', 
Creating new {$branchName} branch );
-
-   $this-runWriteCmd( 'git', 'push', 'origin', $branchName );
+   $originUrl = trim(`git config --get remote.origin.url`);
+   $originUrl = str_replace('https://gerrit.wikimedia.org/r/p/',
+'ssh://gerrit.wikimedia.org:29418/',
+$originUrl);
+$this-runCmd( 'git', 'remote', 'rm', 'origin' );
+$this-runCmd( 'git', 'remote', 'add', 'origin', $originUrl );
+   if ($doPush == true) {
+   $this-runWriteCmd( 'git', 'push', 'origin', 
$branchName );
+   }
}
 
function branchRepo( $path  ) {
@@ -115,9 +122,8 @@
$this-chdir( $repo );
$newVersion = $this-branchPrefix . $this-newVersion;
 
-   $this-createBranch( $newVersion );
-
if ( isset( $this-branchedSubmodules[$path] ) ) {
+   $this-createBranch( $newVersion, false );
foreach ( (array)$this-branchedSubmodules[$path] as 
$submodule ) {
$this-runCmd( 'git', 'submodule', 'update', 
'--init', $submodule );
$this-chdir( $submodule );
@@ -127,7 +133,12 @@
// may be inside a subdirectory
$this-chdir( $this-buildDir );
$this-chdir( $repo );
+   $this-runCmd('git', 'add', $submodule);
}
+   $this-runCmd('git', 'commit', '-q', '--amend', '-m', 
Creating new {$newVersion} branch);
+   $this-runWriteCmd( 'git', 'push', 'origin', 
$newVersion );
+   } else {
+   $this-createBranch( $newVersion, true );
}
$this-chdir( $this-buildDir );
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia31a9f1d849ddf41bf3a31e9cb4505e58b4e57e4
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/tools/release
Gerrit-Branch: master
Gerrit-Owner: 20after4 mmod...@wikimedia.org
Gerrit-Reviewer: 20after4 mmod...@wikimedia.org
Gerrit-Reviewer: Catrope roan.katt...@gmail.com
Gerrit-Reviewer: Jforrester jforres...@wikimedia.org
Gerrit-Reviewer: jenkins-bot 

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


[MediaWiki-commits] [Gerrit] Fix branched sub-submodule support - change (mediawiki...release)

2015-03-12 Thread 20after4 (Code Review)
20after4 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/195972

Change subject: Fix branched sub-submodule support
..

Fix branched sub-submodule support

make-wmf-branch didn't properly commit and push the branched
sub-submodules (currently used by lib/ve in visual editor extension)
Now it updates the remote url to use ssh and pushes the new branch
pointer.

Change-Id: Ia31a9f1d849ddf41bf3a31e9cb4505e58b4e57e4
---
M make-wmf-branch/MakeWmfBranch.php
1 file changed, 16 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/release 
refs/changes/72/195972/1

diff --git a/make-wmf-branch/MakeWmfBranch.php 
b/make-wmf-branch/MakeWmfBranch.php
index e1863c3..661b012 100644
--- a/make-wmf-branch/MakeWmfBranch.php
+++ b/make-wmf-branch/MakeWmfBranch.php
@@ -100,13 +100,20 @@
$this-chdir( $this-buildDir );
}
 
-   function createBranch( $branchName ) {
+   function createBranch( $branchName, $doPush=true ) {
$this-runCmd( 'git', 'checkout', '-q', '-b', $branchName );
 
$this-fixGitReview();
$this-runWriteCmd( 'git', 'commit', '-a', '-q', '-m', 
Creating new {$branchName} branch );
-
-   $this-runWriteCmd( 'git', 'push', 'origin', $branchName );
+   $originUrl = trim(`git config --get remote.origin.url`);
+   $originUrl = str_replace('https://gerrit.wikimedia.org/r/p/',
+'ssh://gerrit.wikimedia.org:29418/',
+$originUrl);
+$this-runCmd( 'git', 'remote', 'rm', 'origin' );
+$this-runCmd( 'git', 'remote', 'add', 'origin', $originUrl );
+   if ($doPush == true) {
+   $this-runWriteCmd( 'git', 'push', 'origin', 
$branchName );
+   }
}
 
function branchRepo( $path  ) {
@@ -115,9 +122,8 @@
$this-chdir( $repo );
$newVersion = $this-branchPrefix . $this-newVersion;
 
-   $this-createBranch( $newVersion );
-
if ( isset( $this-branchedSubmodules[$path] ) ) {
+   $this-createBranch( $newVersion, false );
foreach ( (array)$this-branchedSubmodules[$path] as 
$submodule ) {
$this-runCmd( 'git', 'submodule', 'update', 
'--init', $submodule );
$this-chdir( $submodule );
@@ -127,7 +133,12 @@
// may be inside a subdirectory
$this-chdir( $this-buildDir );
$this-chdir( $repo );
+   $this-runCmd('git', 'add', $submodule);
}
+   $this-runCmd('git', 'commit', '-q', '--amend', '-m', 
Creating new {$newVersion} branch);
+   $this-runWriteCmd( 'git', 'push', 'origin', 
$newVersion );
+   } else {
+   $this-createBranch( $newVersion, true );
}
$this-chdir( $this-buildDir );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia31a9f1d849ddf41bf3a31e9cb4505e58b4e57e4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/release
Gerrit-Branch: master
Gerrit-Owner: 20after4 mmod...@wikimedia.org

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