Support file renames in before/after

Open
#22 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
devtools

Research direction

Start with parsepatch issue #6, then inspect the build_lines_hash logic and how revisions provide paths for before and after modes. Done means renamed files resolve from both paths, unchanged files return the same path twice, and a missing path raises an exception as described in the examples.

Written by the indexing model from the issue text.

Description

bot enhancement

We must support the file renames in a patch. First, parsepatch has to support them, then we need to change the build_lines_hash logic.

The issue hash method should take into account the current mode, and get boths paths from the revision, instead of relying only on the current path.
Exemple, with a file 'test.txt' renamed to 'new_name.txt':

issue_a.path = 'test.txt'
issue_a.mode = 'before'
issue_a.build_lines_hash() # the revision will give ('test.txt', 'new_name.txt') as paths

issue_b.path = 'new_name.txt'
issue_b.mode = 'after'
issue_b.build_lines_hash() # the revision will give ('test.txt', 'new_name.txt') as paths

issue_c.path = 'file.txt'
issue_c.mode = 'after'
issue_c.build_lines_hash() # the revision will raise an Exception as file.txt is not present in the after mode

issue_d.path = 'nochange.txt'
issue_d.mode = 'after'
issue_d.build_lines_hash() # the revision will give ('nochange.txt', 'nochange.txt') as paths
Dominant language
Python
Stars
67
Forks
52
Avg merge
3d 23h
Merged PRs (30d)
54

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/code-review

All issues in mozilla/code-review

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.