diff options
author | Bogdano Arendartchuk <bogdano@mandriva.org> | 2007-06-06 20:41:50 +0000 |
---|---|---|
committer | Bogdano Arendartchuk <bogdano@mandriva.org> | 2007-06-06 20:41:50 +0000 |
commit | d84ac920943e07b4dd78b8ee446f23de6859a1fe (patch) | |
tree | 9891d421b977e84894b38ea76ebba8ea8148ce14 /RepSys/rpmutil.py | |
parent | b2ce8ef1c40f7c58f4bb4629b5b5e95ce8c252d2 (diff) | |
download | mgarepo-d84ac920943e07b4dd78b8ee446f23de6859a1fe.tar mgarepo-d84ac920943e07b4dd78b8ee446f23de6859a1fe.tar.gz mgarepo-d84ac920943e07b4dd78b8ee446f23de6859a1fe.tar.bz2 mgarepo-d84ac920943e07b4dd78b8ee446f23de6859a1fe.tar.xz mgarepo-d84ac920943e07b4dd78b8ee446f23de6859a1fe.zip |
Frontported fixes in mirror support from repsys-1.6
- fixed bad URLs being used when checking out from mirrors
- "switch" subcommand to ease switching between mirror and real
repositories
- smarter "ci"
Diffstat (limited to 'RepSys/rpmutil.py')
-rw-r--r-- | RepSys/rpmutil.py | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/RepSys/rpmutil.py b/RepSys/rpmutil.py index 39e78fc..40aa4fe 100644 --- a/RepSys/rpmutil.py +++ b/RepSys/rpmutil.py @@ -369,17 +369,23 @@ def checkout(pkgdirurl, path=None, revision=None): print "checking out from mirror", current svn.checkout(current, path, revision=SVN.makerev(revision), show=1) -def sync(dryrun=False): - svn = SVN() +def _getpkgtopdir(basedir=None): + if basedir is None: + basedir = os.getcwd() cwd = os.getcwd() dirname = os.path.basename(cwd) if dirname == "SPECS" or dirname == "SOURCES": topdir = os.pardir else: - topdir = "" + topdir = "." + return topdir + +def sync(dryrun=False): + svn = SVN() + topdir = _getpkgtopdir() # run svn info because svn st does not complain when topdir is not an # working copy - svn.info(topdir or ".") + svn.info(topdir) specsdir = os.path.join(topdir, "SPECS/") sourcesdir = os.path.join(topdir, "SOURCES/") for path in (specsdir, sourcesdir): @@ -426,11 +432,16 @@ def sync(dryrun=False): def commit(target=".", message=None): svn = SVN() + status = svn.status(target, silent=True) + if not status: + print "nothing to commit" + return info = svn.info(target) url = info.url if url is None: raise Error, "working copy URL not provided by svn info" - if mirror.enabled(): + mirrored = mirror.enabled(url) + if mirrored: newurl = mirror.switchto_parent(svn, url, target) print "relocated to", newurl try: @@ -440,10 +451,18 @@ def commit(target=".", message=None): mopt = "-m \"%s\"" % message os.system("svn ci %s %s" % (mopt, target)) finally: - if mirror.enabled(): + if mirrored: mirror.switchto_mirror(svn, newurl, target) print "relocated back to", url +def switch(mirrorurl=None): + svn = SVN() + topdir = _getpkgtopdir() + info = svn.info(topdir) + wcurl = info.url + newurl = mirror.autoswitch(svn, topdir, wcurl, mirrorurl) + print "switched to", newurl + def get_submit_info(path): path = os.path.abspath(path) |