← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:schema-upgrade-working-dir into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:schema-upgrade-working-dir into launchpad:master.

Commit message:
Make upgrade.py work regardless of working directory

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397996

It's sometimes convenient to run database schema updates without having to change working directory to somewhere under the Launchpad tree first.  Fix VCS details calculation so that it works regardless of the current working directory.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:schema-upgrade-working-dir into launchpad:master.
diff --git a/database/schema/upgrade.py b/database/schema/upgrade.py
index a6ddc0c..e97b6e7 100755
--- a/database/schema/upgrade.py
+++ b/database/schema/upgrade.py
@@ -257,10 +257,10 @@ def get_vcs_details():
     if _vcs_details_cache is None:
         branch_nick = subprocess.check_output(
             ["git", "rev-parse", "--abbrev-ref", "HEAD"],
-            universal_newlines=True).rstrip("\n")
+            cwd=SCHEMA_DIR, universal_newlines=True).rstrip("\n")
         revision_id = subprocess.check_output(
             ["git", "rev-parse", "HEAD"],
-            universal_newlines=True).rstrip("\n")
+            cwd=SCHEMA_DIR, universal_newlines=True).rstrip("\n")
         _vcs_details_cache = (branch_nick, revision_id)
     return _vcs_details_cache