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

Commit

Permalink
implement applying channels
Browse files Browse the repository at this point in the history
  • Loading branch information
ganwell committed Aug 1, 2021
1 parent 585f536 commit 7c73c51
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -138,3 +138,7 @@ changes
### 0.8.0

* do not switch channels, use --channel for all operations

### 0.9.0

* add command to apply changes from channel iteratively
20 changes: 19 additions & 1 deletion git_pijul.py
Expand Up @@ -20,6 +20,10 @@
batch["VISUAL"] = "/bin/true"


def do_apply(change):
run(["pijul", "apply", change], check=True)


def new(name):
run(["pijul", "channel", "new", f"in_{name}"], check=True)

Expand Down Expand Up @@ -415,14 +419,28 @@ def fill_channel_sets(left, right):
def final_message(head):
print("Please do not modify the in_* channels\n")
print("To get the latest changes call:\n")
print(f"git pijul set-diff -l {head} | xargs pijul apply")
print(f"git pijul apply {head}")


@click.group()
def main():
pass


@main.command()
@click.argument("channel")
def apply(channel):
"""Apply all changes from CHANNEL iteratively"""
left_set, right_set = fill_channel_sets([channel], [])
result = left_set - right_set
while left_set:
change = left_set.pop()
print(f"applying {change}")
do_apply(change)
left_set, right_set = fill_channel_sets([channel], [])
result = left_set - right_set


@main.command()
@click.option(
"--left", "-l", multiple=True, help="Left channel, multiple options allowed"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "git-pijul"
version = "0.8.0"
version = "0.9.0"
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 7c73c51

Please sign in to comment.