+ def selectUrl(self, cmdProtocol = None):
+ if cmdProtocol == None:
+ # reuse parent repo protocol
+ proc = subprocess.Popen(['git', 'ls-remote', '--get-url', 'origin'], stdout=subprocess.PIPE)
+ (stdout, stderr) = proc.communicate()
+
+ if proc.returncode != 0:
+ raise Exception("Failed to execute 'git ls-remote origin', got %d" % proc.returncode)
+ if (stdout[:3] == 'ssh') or (stdout[:3] == 'git'):
+ protocol = 'ssh'
+ else:
+ assert stdout[:5] == 'https'
+ protocol = 'https'
+ else:
+ protocol = cmdProtocol
+
+ if protocol == 'ssh':
+ if self.sshUrl != None:
+ url = self.sshUrl
+ else:
+ assert self.httpsUrl != None
+ url = self.httpsUrl
+ else:
+ assert protocol == 'https'
+ url = self.httpsUrl
+
+ assert url != None
+ return url
+
+ def update (self, cmdProtocol = None):