From 997ebea7a09b1390e4a202429b4bfa1e0ff2db96 Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Thu, 27 Jan 2011 22:04:38 +0000 Subject: make upload and binrepo_delete functions work on text files too --- MgaRepo/rpmutil.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/MgaRepo/rpmutil.py b/MgaRepo/rpmutil.py index 1515183..14789f3 100644 --- a/MgaRepo/rpmutil.py +++ b/MgaRepo/rpmutil.py @@ -661,16 +661,32 @@ def update(target=None): url = info["URL"] download_binaries(br_target, url) -def upload(paths): +def upload(paths, commit=True): for path in paths: - binrepo.upload(path) + if os.path.isdir(path) or binrepo.is_binary(path): + binrepo.upload(path, commit=commit) + else: + svn = SVN() + svn.add(path, local=True) + if commit: + silent = config.get("log", "ignore-string", "SILENT") + message = "%s: new file %s" % (silent, path) + svn.commit(path, log=message) -def binrepo_delete(paths, commit=False): +def binrepo_delete(paths, commit=True): refurl = binrepo.svn_root(paths[0]) if not binrepo.enabled(refurl): raise Error, "binary repository is not enabled for %s" % refurl for path in paths: - binrepo.remove(path) + if binrepo.is_binary(path): + binrepo.remove(path, commit=commit) + else: + svn = SVN() + svn.remove(path, local=True) + if commit: + silent = config.get("log", "ignore-string", "SILENT") + message = "%s: delete file %s" % (silent, path) + svn.commit(path, log=message) def switch(mirrorurl=None): svn = SVN() -- cgit v1.2.1