Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

Commit

Permalink
add git-pijul shallow
Browse files Browse the repository at this point in the history
  • Loading branch information
ganwell committed Jul 27, 2021
1 parent 6da5ad0 commit 7a253f1
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
12 changes: 8 additions & 4 deletions README.md
Expand Up @@ -18,10 +18,11 @@ Usage: git-pijul [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
create create a new pijul repository
update update a repository create with git-pijul
Commands:
create create a new pijul repository
shallow create a new pijul repository from current revision without...
update update a repository created with git-pijul
```

`git-pijul create` finds an ancestry-path with `git rev-list --ancestry-path
Expand All @@ -32,6 +33,9 @@ revision/patchset will be forked into a channel.
`git-pijul update` finds in git the shortest path from the current git-revision
to a existing channel and updates pijul from that channel.

`git-pijul shallow` create a new pijul repository from current revision without
history.

example
-------

Expand Down
35 changes: 34 additions & 1 deletion git_pijul.py
Expand Up @@ -95,6 +95,23 @@ def record(log, author, timestamp):
return res.stdout.strip().decode("UTF-8"), res.stderr.strip().decode("UTF-8")


def record_simple(log):
res = run(
[
"pijul",
"record",
"--all",
"--message",
log,
],
check=True,
env=batch,
stdout=PIPE,
stderr=PIPE,
)
return res.stdout.strip().decode("UTF-8"), res.stderr.strip().decode("UTF-8")


def get_base(head):
return (
run(
Expand Down Expand Up @@ -262,11 +279,27 @@ def main():
pass


@main.command()
def shallow():
"""create a new pijul repository from current revision without history"""
workdir = Path(".").absolute()
check_git()
check_init()
with TemporaryDirectory() as tmp_dir:
prepare_workdir(workdir, tmp_dir)
add_recursive()
head, _ = get_head()
record_simple(f"commit {head}")
pijul_restore()
fork(head)
switch(head)


@main.command()
@click.option("--base", default=None, help="Update from (commit-ish, default '--root')")
@click.option("--head", default=None, help="Update to (commit-ish, default HEAD)")
def update(base, head):
"""update a repository create with git-pijul"""
"""update a repository created with git-pijul"""
workdir = Path(".").absolute()
check_git()
if not Path(".pijul").exists():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "git-pijul"
version = "0.1.5"
version = "0.1.6"
description = "update pijul from git."
authors = ["Jean-Louis Fuchs <jean-louis.fuchs@adfinis-sygroup.ch>"]
license = "AGPL-3.0-or-later"
Expand Down

0 comments on commit 7a253f1

Please sign in to comment.