Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcwimmer committed Jan 7, 2024
1 parent e650b04 commit da0ca9b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 0 additions & 3 deletions gimera/gimera.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,6 @@ def _apply_merges(repo, repo_yml, parallel_safe):
try:
if parallel_safe:
repo2 = tempfile.mktemp(suffix=".")
import pudb

pudb.set_trace()
repo.X(
"git",
"clone",
Expand Down
15 changes: 14 additions & 1 deletion gimera/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
_strip_paths,
temppath,
rsync,
wait_git_lock,
)
import inquirer
from pathlib import Path
Expand Down Expand Up @@ -244,6 +245,8 @@ def _write_patch_content(
# pulled

hex = _clone_directory_and_add_patch_file(
main_repo=main_repo,
repo_yml=repo_yml,
branch=repo_yml.branch,
repo_url=repo_yml.url,
patch_path=patch_dir._path.relative_to(subrepo_path) / patch_filename,
Expand Down Expand Up @@ -304,7 +307,11 @@ def _prepare(main_repo, repo_yml):
yield subrepo, subrepo_path, changed_files, untracked_files


def _clone_directory_and_add_patch_file(branch, repo_url, patch_path, content):
def _clone_directory_and_add_patch_file(
main_repo, repo_yml, branch, repo_url, patch_path, content
):
from .gimera import _fetch_and_reset_branch, _get_cache_dir

with temppath() as path:
path = path / "repo"
subprocess.check_call(["git", "clone", repo_url, path])
Expand All @@ -317,6 +324,12 @@ def _clone_directory_and_add_patch_file(branch, repo_url, patch_path, content):
repo.X("git", "add", patch_path.relative_to(path))
repo.X("git", "commit", "-m", f"added patchfile: {patch_path}")
repo.X("git", "push")
# also make sure that local cache is updated, because
# latest repo version is applied to project
local_repo_dir = _get_cache_dir(main_repo, repo_yml)
with wait_git_lock(local_repo_dir):
repo = Repo(local_repo_dir)
_fetch_and_reset_branch(repo, repo_yml)
return repo.hex


Expand Down

0 comments on commit da0ca9b

Please sign in to comment.