Stack metadata version 4
commitcd98b4e726d641e880bb336fe853f2f8eee9f4ee
authorPeter Grayson <pete@jpgrayson.net>
Sat, 6 Feb 2021 21:13:11 +0000 (6 16:13 -0500)
committerPeter Grayson <pete@jpgrayson.net>
Sat, 6 Feb 2021 21:23:45 +0000 (6 16:23 -0500)
treef9c4f628b35002fe13ac335a8e6f0aa509f93d65
parent50293b994ea889dc53fc48a5201e399e9700b4c5
Stack metadata version 4

The old stack and patch state stored in .git/patches is removed and no
longer used. The stack and patch state stored in refs/heads/<branch>.stgit
is now used to construct Stack objects.

Although the format of the files in the .stgit branch has not changed, the
removal .git/patches warrants the new metadata version 4.

The stack metadata format version is no longer stored in the local git
config. Instead the "Version" line from <branch>.stgit:meta now represents
both the file format version (4) and the overall stack metadata format
version (also 4).

Another metadata change is that "patch log" refs are removed. I.e.
refs/patches/<branch>/<patch>.log refs no longer exist. These patch log
refs were redundant with the patch metadata found in
<branch>.stgit:patches/<patch>. Viewing per-patch logs can still be
accomplished with `stg log <patch>`.

Rudimentary support for pulling stack state from a remote (i.e. pulling
from a remote .stgit ref) is added. A couple changes of note to support
this:

- When a Stack is instantiated from the stack state metadata (from the
  .stgit branch), there is code that ensures that all of the patch refs
  (i.e. refs/patches/<branch>/*) exist and point to the correct commit.
  Thus pulling *only* the <branch>.stgit ref from a remote is sufficient;
  the patch refs do not need to be pulled separately.

- Eliminating the metadata format version from the config enables a branch
  and its corresponding StGit metadata branch to be fully initialized
  simply by pulling those branches from a remote since all of the relevant
  metadata is now entirely contained within git objects in the repository.

- t2110-pull-stack.sh is added to test this rudimentary stack pulling
  behavior.

Signed-off-by: Peter Grayson <pete@jpgrayson.net>
stgit/lib/git/repository.py
stgit/lib/log.py
stgit/lib/stack.py
stgit/lib/stackupgrade.py
stgit/utils.py
t/t1000-branch-create.sh
t/t2110-pull-stack.sh [new file with mode: 0755]
t/t4000-upgrade.sh