Item 6: plain sisi update on an installed copy runs the post step. done / next: item 8
This commit is contained in:
1 parent
32a4fa3c41
commit
9632c6addb
2 files changed
+9
-5
No files matched your search
+3
-3
@@ -444,9 +444,9 @@ def cmd_update(args):
|
||||
try:
|
||||
top = _pgit("rev-parse", "--show-toplevel")
|
||||
if top.returncode != 0 or os.path.realpath(top.stdout.strip()) != os.path.realpath(paths.REPO):
|
||||
say("sisi update: %s is not a git clone, so there is nothing to fetch. Replace it with a newer copy and run "
|
||||
"`sisi update --post` to rebuild." % paths.REPO)
|
||||
return 1
|
||||
say("sisi update: %s is not a git clone, so the product itself is updated by a release; "
|
||||
"backing up, migrating and rebuilding your data now." % paths.REPO)
|
||||
return post_update()
|
||||
if _pgit("rev-parse", "--verify", "-q", "HEAD").returncode != 0:
|
||||
say("sisi update: the product repository has no commits yet; nothing to update.")
|
||||
return 1
|
||||
|
||||
@@ -377,10 +377,14 @@ class UpdateTests(PersonalCase):
|
||||
self.assertIn("already up to date", r.stdout)
|
||||
self.assertEqual(len([l for l in open(os.path.join(self.data, "retest.jsonl"))]), 1)
|
||||
|
||||
def test_update_refuses_outside_a_git_clone(self):
|
||||
def test_update_outside_a_git_clone_runs_the_post_step(self):
|
||||
"""R-14.4-1, R-3.2-4: an installed copy is updated by a release, but plain `sisi update` still
|
||||
backs up, migrates and rebuilds the user's data and exits 0."""
|
||||
r = self.sisi("update")
|
||||
self.assertEqual(r.returncode, 1)
|
||||
self.assertEqual(r.returncode, 0, r.stdout + r.stderr)
|
||||
self.assertIn("not a git clone", r.stdout)
|
||||
self.assertIn("backup:", r.stdout)
|
||||
self.assertIn("rulebook rebuilt", r.stdout)
|
||||
|
||||
|
||||
def _seed_legacy_db(path, lessons, proj):
|
||||
|
||||
Reference in new issue
Block a user