Dzahn has submitted this change and it was merged.

Change subject: Support easy cloning of git repositories from Phabricator
......................................................................


Support easy cloning of git repositories from Phabricator

Introduce a new $default_source parameter that can be set
to 'phabricator' so you don't have to rewrite the full Phab
diffusion URL each time in $origin

Will also allow for easier gradual migration and an (eventual)
future in which Phabricator repos are the default.

Change-Id: I166a5b77562742a5987c8e72aa27adb14b4b7f07
---
M modules/git/manifests/clone.pp
1 file changed, 10 insertions(+), 3 deletions(-)

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



diff --git a/modules/git/manifests/clone.pp b/modules/git/manifests/clone.pp
index 3c282d3..cce0eff 100644
--- a/modules/git/manifests/clone.pp
+++ b/modules/git/manifests/clone.pp
@@ -27,6 +27,8 @@
 # $+mode+:: Permission mode of $directory, default: 2755 if shared, 0755 
otherwise
 # $+ssh+:: SSH command/wrapper to use when checking out, default: ''
 # $+timeout+:: Time out in seconds for the exec command, default: 300
+# $+default_source+:: Where to request the repo from, if $origin isn't 
specified
+#                     default to 'gerrit', 'phabricator' also accepted
 #
 # === Example usage
 #
@@ -57,12 +59,17 @@
     $depth='full',
     $recurse_submodules=false,
     $umask=undef,
-    $mode=undef) {
+    $mode=undef,
+    $default_source='gerrit') {
 
-    $gerrit_url_format = 'https://gerrit.wikimedia.org/r/p/%s.git'
+    $default_url_format = $default_source ? {
+        'phabricator' => 'https://phabricator.wikimedia.org/diffusion/%.git',
+        'gerrit'      => 'https://gerrit.wikimedia.org/r/p/%s.git',
+        default       => 'https://gerrit.wikimedia.org/r/p/%s.git',
+    }
 
     $remote = $origin ? {
-        undef   => sprintf($gerrit_url_format, $title),
+        undef   => sprintf($default_url_format, $title),
         default => $origin,
     }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I166a5b77562742a5987c8e72aa27adb14b4b7f07
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Dzahn <dz...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to