Skip to content

hg: read rejects file contents in-memory (Bug 2031725)#1089

Closed
cgsheeh wants to merge 2 commits intomozilla-conduit:mainfrom
cgsheeh:rejects-memory
Closed

hg: read rejects file contents in-memory (Bug 2031725)#1089
cgsheeh wants to merge 2 commits intomozilla-conduit:mainfrom
cgsheeh:rejects-memory

Conversation

@cgsheeh
Copy link
Copy Markdown
Member

@cgsheeh cgsheeh commented Apr 15, 2026

Use of the hard-coded /tmp/rejects_path directory to store
.rej file contents causes intermittent test failures during
parallelized test runs. Tests will attempt to clear the
directory during clean_repo and the later read file contents
in process_merge_conflicts, causing several different
intermittent failures from this single issue.

Change HgSCM to read the rejects content into an in-memory
instance variable, which is initialized empty and cleared at
the same time the previous implementation would rmdir the
directory. Move logic to an instance method and add a unit test
for the parsing logic. Expand tests to ensure parsing cannot fail on
invalid UTF-8, and that the in-memory rejects are properly
parsed on PatchConflict.

Use of the hard-coded `/tmp/rejects_path` directory to store
`.rej` file contents causes intermittent test failures during
parallelized test runs. Tests will attempt to clear the
directory during `clean_repo` and the later read file contents
in `process_merge_conflicts`, causing several different
intermittent failures from this single issue.

Change `HgSCM` to read the rejects content into an in-memory
instance variable, which is initialized empty and cleared at
the same time the previous implementation would `rmdir` the
directory. Move logic to an instance method and add a unit test
for the parsing logic. Expand tests to ensure parsing cannot fail on
invalid UTF-8, and that the in-memory rejects are properly
parsed on `PatchConflict`.
@cgsheeh cgsheeh requested a review from a team as a code owner April 15, 2026 21:28
@github-actions
Copy link
Copy Markdown

View this pull request in Lando to land it once approved.

Copy link
Copy Markdown
Member

@shtrom shtrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+ w/ nit

Comment thread src/lando/main/scm/hg.py

def __init__(self, path: str, config: dict | None = None, **kwargs):
self.config = copy.copy(self.DEFAULT_CONFIGS)
self.rejects_content: dict[str, str] = {}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could we forward-declare this attribute at the top of the class definition?

lando-worker bot pushed a commit that referenced this pull request Apr 16, 2026
Use of the hard-coded `/tmp/rejects_path` directory to store
`.rej` file contents causes intermittent test failures during
parallelized test runs. Tests will attempt to clear the
directory during `clean_repo` and the later read file contents
in `process_merge_conflicts`, causing several different
intermittent failures from this single issue.

Change `HgSCM` to read the rejects content into an in-memory
instance variable, which is initialized empty and cleared at
the same time the previous implementation would `rmdir` the
directory. Move logic to an instance method and add a unit test
for the parsing logic. Expand tests to ensure parsing cannot fail on
invalid UTF-8, and that the in-memory rejects are properly
parsed on `PatchConflict`.

Pull request: #1089
@lando-worker
Copy link
Copy Markdown

lando-worker bot commented Apr 16, 2026

Pull request closed by commit 24ea73f

@lando-worker lando-worker bot closed this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants