repoactive 0.2.4.dev1__tar.gz → 0.2.4.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/PKG-INFO +1 -1
  2. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/pyproject.toml +1 -1
  3. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/jj.py +21 -9
  4. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/platforms/gitlab.py +5 -2
  5. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/runner.py +4 -2
  6. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/.gitignore +0 -0
  7. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/LICENSE +0 -0
  8. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/README.md +0 -0
  9. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/__init__.py +0 -0
  10. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/cli.py +0 -0
  11. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/config.py +0 -0
  12. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/constants.py +0 -0
  13. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/graph.py +0 -0
  14. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/jobtree.py +0 -0
  15. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/lock.py +0 -0
  16. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/platforms/__init__.py +0 -0
  17. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/platforms/base.py +0 -0
  18. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/platforms/github.py +0 -0
  19. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/progress.py +0 -0
  20. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/settings.py +0 -0
  21. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/ui.py +0 -0
  22. {repoactive-0.2.4.dev1 → repoactive-0.2.4.dev2}/src/repoactive/updates.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: repoactive
3
- Version: 0.2.4.dev1
3
+ Version: 0.2.4.dev2
4
4
  Summary: Script-driven code changes with automated merge requests
5
5
  License-Expression: GPL-3.0-or-later
6
6
  License-File: LICENSE
@@ -10,7 +10,7 @@ only-include = ["src"]
10
10
 
11
11
  [project]
12
12
  name = "repoactive"
13
- version = "0.2.4.dev1"
13
+ version = "0.2.4.dev2"
14
14
  description = "Script-driven code changes with automated merge requests"
15
15
  readme = "README.md"
16
16
  requires-python = ">=3.11"
@@ -1,6 +1,7 @@
1
1
  """Wrapper around the jj (Jujutsu) CLI for managing colocated jj+git repositories."""
2
2
 
3
3
  import contextlib
4
+ import enum
4
5
  import logging
5
6
  import shutil
6
7
  import subprocess
@@ -15,6 +16,12 @@ from repoactive.constants import JOB_TRAILER_KEY
15
16
 
16
17
  logger = logging.getLogger(__name__)
17
18
 
19
+
20
+ class Colocation(enum.Enum):
21
+ COLOCATED = "colocated"
22
+ PLAIN = "plain"
23
+
24
+
18
25
  # Prefix for the temporary workspaces repoactive creates for each job. It is not
19
26
  # configurable so that stale workspaces (left behind by a killed run) can always
20
27
  # be recognised and reclaimed by name (see JJ.forget_stale_workspaces).
@@ -181,9 +188,9 @@ class JJ:
181
188
  )
182
189
  raise CommandFailedError(program, args, e.stderr) from e
183
190
  logger.debug(
184
- "%s %s -> %d bytes in %.3fs",
191
+ "%s %s ... -> %d bytes in %.3fs",
185
192
  program,
186
- " ".join(args),
193
+ " ".join(args[:1]),
187
194
  len(result.stdout),
188
195
  time.monotonic() - start,
189
196
  )
@@ -472,7 +479,7 @@ class JJ:
472
479
  """Sync the colocated git checkout (HEAD and index) to the jj working copy.
473
480
 
474
481
  jj only exports git HEAD in the default workspace; workspaces colocated
475
- via workspace_add() need this after the working copy moves (new, edit,
482
+ via _workspace_add() need this after the working copy moves (new, edit,
476
483
  rebase). No-op if the workspace is not colocated.
477
484
  """
478
485
  if not self.is_colocated():
@@ -508,9 +515,11 @@ class JJ:
508
515
  if stale:
509
516
  self.git_worktree_prune()
510
517
 
511
- def workspace_add(self, name: str, path: Path) -> None:
518
+ def _workspace_add(
519
+ self, name: str, path: Path, colocation: Colocation = Colocation.COLOCATED
520
+ ) -> None:
512
521
  self._run("workspace", "add", "--name", name, str(path))
513
- if self.is_colocated():
522
+ if colocation is Colocation.COLOCATED and self.is_colocated():
514
523
  self._colocate_workspace(name, path)
515
524
 
516
525
  def _colocate_workspace(self, name: str, path: Path) -> None:
@@ -541,7 +550,9 @@ class JJ:
541
550
  self._run("workspace", "forget", name)
542
551
 
543
552
  @contextlib.contextmanager
544
- def temp_workspace(self, name: str) -> Generator["JJ"]:
553
+ def temp_workspace(
554
+ self, name: str, colocation: Colocation = Colocation.COLOCATED
555
+ ) -> Generator["JJ"]:
545
556
  """Create a workspace named ``name`` in a temp directory, cleaning up on exit.
546
557
 
547
558
  Adds a jj workspace inside a fresh temp directory and yields a JJ bound
@@ -552,7 +563,7 @@ class JJ:
552
563
  tmp_root = Path(tempfile.mkdtemp(prefix="repoactive-workspace-"))
553
564
  workspace_path = tmp_root / "workspace"
554
565
  logger.debug("adding workspace %s at %s", name, workspace_path)
555
- self.workspace_add(name, workspace_path)
566
+ self._workspace_add(name, workspace_path, colocation)
556
567
  try:
557
568
  yield JJ(workspace_path)
558
569
  finally:
@@ -560,5 +571,6 @@ class JJ:
560
571
  with contextlib.suppress(JJError):
561
572
  self.workspace_forget(name)
562
573
  shutil.rmtree(tmp_root, ignore_errors=True)
563
- with contextlib.suppress(JJError):
564
- self.git_worktree_prune()
574
+ if colocation is Colocation.COLOCATED:
575
+ with contextlib.suppress(JJError):
576
+ self.git_worktree_prune()
@@ -1,7 +1,7 @@
1
1
  """GitLab platform implementation using python-gitlab."""
2
2
 
3
3
  import gitlab
4
- from gitlab.exceptions import GitlabError
4
+ from gitlab.exceptions import GitlabError, GitlabMRClosedError
5
5
 
6
6
  from repoactive.platforms.base import MRParams, Platform, PlatformError
7
7
 
@@ -50,5 +50,8 @@ class GitLabPlatform(Platform):
50
50
  }
51
51
  )
52
52
  if params.auto_merge:
53
- mr.merge(merge_when_pipeline_succeeds=True)
53
+ try:
54
+ mr.merge(merge_when_pipeline_succeeds=True)
55
+ except GitlabMRClosedError as e:
56
+ print(f" warning: could not enable auto-merge ({e})")
54
57
  return mr.web_url
@@ -28,7 +28,7 @@ from repoactive.config import (
28
28
  )
29
29
  from repoactive.constants import JOB_TRAILER_KEY
30
30
  from repoactive.graph import CircularDependencyError, detect_dependency_cycle, topological_sort
31
- from repoactive.jj import JJ, workspace_name
31
+ from repoactive.jj import JJ, Colocation, workspace_name
32
32
  from repoactive.jobtree import format_job_forest, print_job_table
33
33
  from repoactive.lock import run_lock
34
34
  from repoactive.platforms.base import MRParams, Platform
@@ -1030,7 +1030,9 @@ def _absorb_results(
1030
1030
  )
1031
1031
  if not content_unchanged:
1032
1032
  if abs_ws is None:
1033
- abs_ws = stack.enter_context(repo.temp_workspace("repoactive-absorb"))
1033
+ abs_ws = stack.enter_context(
1034
+ repo.temp_workspace("repoactive-absorb", Colocation.PLAIN)
1035
+ )
1034
1036
  abs_ws.restore(source_rev=new_cid, destination_rev=old_cid)
1035
1037
  repo.describe_revision(old_cid, message)
1036
1038
  elif _strip_boxquote_and_trailers(
File without changes