Hello,
Sorry about that I already noticed an error in it. Here's a fixed one.
I've tested the http/https method, but have not used the HG+SSH one
yet....
Brian
On Thu, 2009-01-22 at 14:05 -0700, Brian Kosick wrote:
> Hi All,
>
> First off, I'd like to say that I'm still in the n00b period of learning
> python and have heard that bad coding with it takes a little bit of
> extra effort. I'm happy to say that I think that the koji maintainers
> are too lazy to put that extra bit of effort in. I found the code in
> kojid to be easily readable. The variables, classes and methods were
> well named and the flow of the code made sense.
>
> What are you guys thinking?!?!
>
> These are tough times and you should be thinking about naming schemes
> that only the original author could love. Cryptic variable names and
> convoluted work-flows are core synergies to job security!
>
> Anyways, in between trying to deepen the dent on my desk via the manual
> "forehead" method, constant interruptions, and managements infuriating
> refusal to allow me to throttle those same interrupters, I came up with
> this patch to koji 1.2.6 it allows Mercurial to be used as a SCM.
>
> Thanks for the un-convoluted code!
>
> Brian
--- kojid 2009-01-22 14:25:25.000000000 -0700
+++ kojid.new 2009-01-22 14:25:19.000000000 -0700
@@ -2325,7 +2325,9 @@
'GIT': ('git://', 'git+http://', 'git+https://', 'git+rsync://'),
'GIT+SSH': ('git+ssh://',),
'SVN': ('svn://', 'svn+http://', 'svn+https://'),
- 'SVN+SSH': ('svn+ssh://',) }
+ 'SVN+SSH': ('svn+ssh://',),
+ 'HG': ('hg://', 'hg+http://', 'hg+https://'),
+ 'HG+SSH': ('hg+ssh',) }
def is_scm_url(url):
"""
@@ -2556,6 +2558,26 @@
module_checkout_cmd = ['svn', 'checkout', '-r', self.revision, '%s/%s' % (svnserver, self.module), self.module]
common_checkout_cmd = ['svn', 'checkout', '%s/common' % svnserver]
+ elif self.scmtype == 'HG':
+ scheme = self.scheme
+ if '+' in scheme:
+ scheme = scheme.split('+')[1]
+ # Make http:// the scheme as hg:// is not valid with mercurial.
+ if 'hg://' in scheme:
+ scheme = scheme.replace(scheme, 'http://')
+
+ hgserver = '%s%s%s' % (scheme, self.host, self.repository)
+ module_checkout_cmd = ['hg', 'clone', '-r', self.revision, '%s/%s' % (hgserver, self.module), self.module]
+ common_checkout_cmd = ['hg', 'clone', '%s/common' % hgserver]
+
+ elif self.scmtype == 'HG+SSH':
+ if not self.user:
+ raise koji.BuildError, 'No user specified for repository access scheme: %s' % self.scheme
+
+ hgserver = 'ssh://%...@%s%s' % (self.user, self.host, self.repository)
+ module_checkout_cmd = ['hg', 'clone', '-r', self.revision, '%s/%s' % (hgserver, self.module), self.module]
+ common_checkout_cmd = ['hg', 'clone', '%s/common' % hgserver]
+
else:
raise koji.BuildError, 'Unknown SCM type: %s' % self.scmtype
--
Fedora-buildsys-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list