From 161b392505a6bd1da898536b7abc04eabffc3f40 Mon Sep 17 00:00:00 2001 From: jan Date: Sat, 26 Dec 2020 01:09:17 -0800 Subject: [PATCH] auto-migrate commits which use the old scheme --- lethe/lethe.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lethe/lethe.py b/lethe/lethe.py index 815e147..62c18d0 100755 --- a/lethe/lethe.py +++ b/lethe/lethe.py @@ -287,6 +287,15 @@ def snap(parent_refs: Optional[Sequence[str]] = None, target_refs += [target_base + '/LATEST', target_base + '/' + date_ref] + # Auto-migrate old commits to work with the new scheme + old_base_commit = get_commit(target_base, cwd=cwd) + if old_base_commit: + print(f'Migrating {target_base} to new naming scheme...') + _run('git update-ref -d ' + target_base) + update_ref(target_base + '/LEGACY', old_base_commit, + message='last commit using old refs/lethe/branchname approach') + + if message is None: message = 'snapshot ' + date_str