PSCP is a brand-new way to make checkpoint in git repository efficiently.
By logging the hash output by pscp.create()
, you can git diff
, git stash branch
and git checkout
using them whenever you want.
PSCP is framework-agnostic, so can be used in any git repository.
PSCP inherits all strengths from git, which are very useful for study.
- Recycle unchanged objects
- Compression (zlib)
- Show differences using
git diff a..b
- Checkout to, using
git checkout
- Create branch from, using
git stash branch
. This restores staged files staged and unstaged files unstaged.
Besides, PSCP does make neither git log
nor git stash list
messy. You won't suffer from trivial tuning commits and too many stashes.
- python 3.5+
- git
pip install pscp
No, PSCP saves git-tracked files only. For details, please refer to 2.2 Git Basics - Recording Changes to the Repository.
Use git add
to stage, to track new files. Untracked files will not be added to the checkpoint.
You're supposed to write to any file and track them (using git add
).
Using json built-in library, it can be done easily.
import json
To save environment variables,
import os
json.dump(fp, dict(os.environ), indent=4)
To save argparse namespace,
json.dump(fp, vars(args), indent=4)
Any other data can be saved in same way.
python -m pscp
Create per-session checkpoint.
return_head_on_nothing
: If True, return hash ofHEAD
when there are nothing changed compared toHEAD
, otherwise, returnNone
.return_format
abbrev
,short
: Return abbreviated hash.long
: Return just unabbreviated hash.ref
: Return refspec. Raises exception when link == False.
link
: Seepscp.link()
below.
Create reference. pscp.link()
could be used to avoid pruning on garbage collection.
hash
: The hash to be referenced.refspec
: IfNone
,refs/pscp/{timestamp_ms}
is used.
Delete pscp reference. Call pscp.gc()
if you want.
refspec
: Target refspec to be deleted.timestamp_ms
is also allowed.
Run git gc --prune=<prune>
.
Push checkpoint to the remote repository.
refspec
: IfNone
, all checkpoints are pushed.
refspec
: IfNone
, all checkpoints are fetched.refmap
: IfNone
,refs/pscp/*:refs/pscp/*
is used.