diff options
author | Bogdano Arendartchuk <bogdano@mandriva.org> | 2007-04-25 20:42:50 +0000 |
---|---|---|
committer | Bogdano Arendartchuk <bogdano@mandriva.org> | 2007-04-25 20:42:50 +0000 |
commit | e554aebc20aeb12256cc81d072c30ccc3f4eeb68 (patch) | |
tree | 84491f53ef9dd608c5382b00bd598b9e1b930687 | |
parent | 9ff10dd337e9de6e954b4125a17d89ec2b7cd8e9 (diff) | |
download | mgarepo-topic/V1_6_X-mirrorsupport.tar mgarepo-topic/V1_6_X-mirrorsupport.tar.gz mgarepo-topic/V1_6_X-mirrorsupport.tar.bz2 mgarepo-topic/V1_6_X-mirrorsupport.tar.xz mgarepo-topic/V1_6_X-mirrorsupport.zip |
Argh! Forgot to add new files to svn.topic/V1_6_X-mirrorsupport
-rw-r--r-- | RepSys/commands/ci.py | 29 | ||||
-rw-r--r-- | RepSys/mirror.py | 42 |
2 files changed, 71 insertions, 0 deletions
diff --git a/RepSys/commands/ci.py b/RepSys/commands/ci.py new file mode 100644 index 0000000..9ffa3bd --- /dev/null +++ b/RepSys/commands/ci.py @@ -0,0 +1,29 @@ +#!/usr/bin/python +from RepSys.command import * +from RepSys.rpmutil import commit + +HELP = """\ +Usage: repsys ci [TARGET] + +Will commit a change. The difference between an ordinary "svn ci" and +"repsys ci" is that it relocates the working copy to the default repository +in case the option "mirror" is set in repsys.conf. + +Options: + -h Show this message + +Examples: + repsys ci + repsys ci SPECS/package.spec SPECS/package-patch.patch +""" + +def parse_options(): + parser = OptionParser(help=HELP) + parser.add_option("-m", dest="message", default=None) + opts, args = parser.parse_args() + if len(args): + opts.target = args[0] + return opts + +def main(): + do_command(parse_options, commit) diff --git a/RepSys/mirror.py b/RepSys/mirror.py new file mode 100644 index 0000000..a24f594 --- /dev/null +++ b/RepSys/mirror.py @@ -0,0 +1,42 @@ +import os +import urlparse + +from RepSys import config +from RepSys.svn import SVN + +def relocate_path(oldparent, newparent, url): + subpath = url[len(oldparent)-1:] + newurl = newparent + "/" + subpath # subpath usually gets / at begining + return newurl + +def enabled(): + mirror = config.get("global", "mirror") + default_parent = config.get("global", "default_parent") + return (mirror is not None and + default_parent is not None) + +def mirror_relocate(oldparent, newparent, url, wcpath): + svn = SVN(noauth=True) + newurl = relocate_path(oldparent, newparent, url) + svn.switch(newurl, url, path=wcpath, relocate="True") + return newurl + +def switchto_parent(svn, url, path): + """Relocates the working copy to default_parent""" + mirror = config.get("global", "mirror") + default_parent = config.get("global", "default_parent") + newurl = mirror_relocate(mirror, default_parent, url, path) + return newurl + +def switchto_mirror(svn, url, path): + mirror = config.get("global", "mirror") + default_parent = config.get("global", "default_parent") + newurl = mirror_relocate(default_parent, mirror, url, path) + return newurl + +def checkout_url(url): + mirror = config.get("global", "mirror") + default_parent = config.get("global", "default_parent") + if mirror is not None and default_parent is not None: + return relocate_path(default_parent, mirror, url) + return url |