Merge "Workflow documentation is now in infra-manual"
diff --git a/jeepyb/cmd/expire_old_reviews.py b/jeepyb/cmd/expire_old_reviews.py
index fe5956f..ef67e3a 100644
--- a/jeepyb/cmd/expire_old_reviews.py
+++ b/jeepyb/cmd/expire_old_reviews.py
@@ -15,7 +15,7 @@
 
 # This script is designed to expire old code reviews that have not been touched
 # using the following rules:
-# 1. if negative comment and no activity in 1 week, expire
+# 1. if negative comment and no recent activity, expire
 
 import argparse
 import json
@@ -27,7 +27,7 @@
 
 
 def expire_patch_set(ssh, patch_id, patch_subject):
-    message = ('Code review expired after 1 week of no activity'
+    message = ('Code review expired due to no recent activity'
                ' after a negative review. It can be restored using'
                ' the \`Restore Change\` button under the Patch Set'
                ' on the web interface.')
@@ -47,10 +47,13 @@
     parser = argparse.ArgumentParser()
     parser.add_argument('user', help='The gerrit admin user')
     parser.add_argument('ssh_key', help='The gerrit admin SSH key file')
+    parser.add_argument('--age', dest='age', default='1w',
+                        help='The minimum age of a review to expire')
     options = parser.parse_args()
 
     GERRIT_USER = options.user
     GERRIT_SSH_KEY = options.ssh_key
+    EXPIRY_AGE = options.age
 
     logging.basicConfig(format='%(asctime)-6s: %(name)s - %(levelname)s'
                                ' - %(message)s',
@@ -68,7 +71,7 @@
     logger.info('Searching no activity on negative review for 1 week')
     stdin, stdout, stderr = ssh.exec_command(
         'gerrit query --current-patch-set --all-approvals'
-        ' --format JSON status:reviewed age:1w')
+        ' --format JSON status:reviewed age:' + EXPIRY_AGE)
 
     for line in stdout:
         row = json.loads(line)
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index ff5b4c7..6ad970e 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -395,6 +395,10 @@
 
 
 def update_local_copy(repo_path, track_upstream, git_opts, ssh_env):
+    # first do a clean of the branch to prevent possible
+    # problems due to previous runs
+    git_command(repo_path, "clean -fdx")
+
     has_upstream_remote = (
         'upstream' in git_command_output(repo_path, 'remote')[1])
     if track_upstream:
diff --git a/jeepyb/cmd/openstackwatch.py b/jeepyb/cmd/openstackwatch.py
index c984818..726912a 100644
--- a/jeepyb/cmd/openstackwatch.py
+++ b/jeepyb/cmd/openstackwatch.py
@@ -32,9 +32,9 @@
 import time
 
 import PyRSS2Gen
-import six.moves.urllib.parse as urlparse
+import six.moves.urllib.request as urlrequest
 
-PROJECTS = ['openstack/nova', 'openstack/keystone', 'opensack/swift']
+PROJECTS = ['openstack/nova', 'openstack/keystone', 'openstack/swift']
 JSON_URL = 'https://review.openstack.org/query'
 DEBUG = False
 OUTPUT_MODE = 'multiple'
@@ -94,7 +94,7 @@
     url = CONFIG['json_url']
     if project:
         url += "+project:" + project
-    fp = urlparse.urlretrieve(url)
+    fp = urlrequest.urlretrieve(url)
     ret = open(fp[0]).read()
     return ret