aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Casagrande <milo@ubuntu.com>2013-02-07 13:52:38 +0100
committerMilo Casagrande <milo@ubuntu.com>2013-02-07 13:52:38 +0100
commita624a9522a62fb3baf5b96acb21ab18eaf06a058 (patch)
treed9ae5c2a8da730528405dff02f45fe2d715abe37
parent908370218370238e06faf90b19f078727c04fedb (diff)
downloadrhodecode-config-a624a9522a62fb3baf5b96acb21ab18eaf06a058.tar.gz
Added comment, reworked command calls.
-rw-r--r--scripts/mirror-repos16
-rw-r--r--scripts/update-server-info5
2 files changed, 15 insertions, 6 deletions
diff --git a/scripts/mirror-repos b/scripts/mirror-repos
index 483f17f..f9d7929 100644
--- a/scripts/mirror-repos
+++ b/scripts/mirror-repos
@@ -154,15 +154,19 @@ def mirror_repos(file, dest, user=None):
full_repo = urlparse.urljoin(BASE_PATH, line)
cmd_args = ["git", "clone", "--mirror", full_repo]
- logger.info("Cloning repository %s..." % full_repo)
actual_user = pwd.getpwuid(os.getuid())[0]
if actual_user == DEFAULT_USER or not user:
- execute_command(cmd_args, work_dir=full_path)
+ as_user = None
+ as_root = False
else:
- execute_command(cmd_args,
- work_dir=full_path,
- as_root=True,
- user=user)
+ as_user = user
+ as_root = True
+
+ logger.info("Cloning repository %s..." % full_repo)
+ execute_command(cmd_args,
+ work_dir=full_path,
+ as_root=as_root,
+ user=as_user)
else:
logger.debug("Skipping repository '%s', does not seem a valid "
"git one." % base_dir)
diff --git a/scripts/update-server-info b/scripts/update-server-info
index 18db5b7..d028dc6 100644
--- a/scripts/update-server-info
+++ b/scripts/update-server-info
@@ -27,6 +27,11 @@ def args_parser():
def update_server_info(repos_dir, user):
+ """Runs command 'git update-server-info' on the repositories.
+
+ :param repos_dir: The directory where repositories are located.
+ :param user: The user to run the command as.
+ """
for root, dirs, files in os.walk(os.path.abspath(repos_dir)):
if GIT_DIRECTORY_ENDS.match(root):
if files: