Closed Bug 1633662 Opened 5 years ago Closed 2 years ago

Remove unused mozversioncontrol functions

Categories

(Firefox Build System :: General, task, P3)

task

Tracking

(firefox111 fixed)

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: saschanaz, Assigned: gzyfqh)

References

Details

(Keywords: good-first-bug)

Attachments

(1 file)

Those include .base_ref, .head_ref, and get_upstream.

Priority: -- → P3

base_ref and head_ref are going to be called directly or indirectly by tools/tryselect/selectors/coverage.py, or at least that seems to be the case from quick grepping. get_upstream can probably go though.

See Also: → 1643192
Assignee: nobody → surajeet310

This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit auto_nag documentation.

Assignee: surajeet310 → nobody

Can I take over and work on this bug?

I guess you can, although the reviewer should be #firefox-build-system-reviewers this time. base_ref and head_ref are now used in https://searchfox.org/mozilla-central/rev/daf613efc5c358f3a94961d73b90472c00703838/tools/tryselect/selectors/compare.py#36,40 as Ricky said above, while get_upstream can go.

(In reply to Kagami [:saschanaz] from comment #4)

I guess you can, although the reviewer should be #firefox-build-system-reviewers this time. base_ref and head_ref are now used in https://searchfox.org/mozilla-central/rev/daf613efc5c358f3a94961d73b90472c00703838/tools/tryselect/selectors/compare.py#36,40 as Ricky said above, while get_upstream can go.

I still see .base_ref, .head_ref, and get_upstream. functions in the codebase.

Is there anything else I should be aware of when dealing with this bug?

Also, does the compare.py file you mentioned need to be modified?

(In reply to Ho Cheung from comment #5)>

I still see .base_ref, .head_ref, and get_upstream. functions in the codebase.

Where do you see get_upstream? If it's in testing/web-platform/tests/, you can ignore it as it has its own definition.

Is there anything else I should be aware of when dealing with this bug?

Also, does the compare.py file you mentioned need to be modified?

No, only https://searchfox.org/mozilla-central/source/python/mozversioncontrol/mozversioncontrol/__init__.py should be modified.

(In reply to Kagami [:saschanaz] from comment #6)

(In reply to Ho Cheung from comment #5)>

I still see .base_ref, .head_ref, and get_upstream. functions in the codebase.

Where do you see get_upstream? If it's in testing/web-platform/tests/, you can ignore it as it has its own definition.

Is there anything else I should be aware of when dealing with this bug?

Also, does the compare.py file you mentioned need to be modified?

No, only https://searchfox.org/mozilla-central/source/python/mozversioncontrol/mozversioncontrol/__init__.py should be modified.

In addition to the testing directory, I found get_upstream in the python directory and taskcluster directory

I will post a commit about this bug in the near future

In addition to the testing directory, I found get_upstream in the python directory

Those are the ones we want to remove here!

and taskcluster directory

That one is get_upstream_task_ref, not get_upstream.

(In reply to Kagami [:saschanaz] from comment #8)

In addition to the testing directory, I found get_upstream in the python directory

Those are the ones we want to remove here!

and taskcluster directory

That one is get_upstream_task_ref, not get_upstream.

I just looked at the code and found that the three functions .base_ref, .head_ref and get_upstream are still in use (maybe my conclusion is incorrect?).

These three functions seem to pass some parameters.

The former two are indeed in use as said above. Not sure what you saw about get_upstream, can you point me to the file and the line number?

Flags: needinfo?(gzyfqh)

(In reply to Kagami [:saschanaz] from comment #10)

The former two are indeed in use as said above. Not sure what you saw about get_upstream, can you point me to the file and the line number?

Please see line 632 of the file in the link below

https://searchfox.org/mozilla-central/source/python/mozversioncontrol/mozversioncontrol/__init__.py#170,433,632

Flags: needinfo?(gzyfqh)

Good catch, and those are exactly the lines we want to remove here. Those are not "in use", rather those are function definitions that are never called and thus are redundant.

(In reply to Kagami [:saschanaz] from comment #12)

Good catch, and those are exactly the lines we want to remove here. Those are not "in use", rather those are function definitions that are never called and thus are redundant.

I plan to do this in an upcoming commit:

Delete lines 169-172, delete lines 433-435, and modify def get_upstream(self): in line 632 to def upstream(self):

Am I doing this correctly?

I would remove them all, any specific reason you want to keep line 632?

(In reply to Kagami [:saschanaz] from comment #14)

I would remove them all, any specific reason you want to keep line 632?

I see that the function below also passes some parameters and returns some hints. There are also some function calls

I'm worried that removing this function like this will cause breaking changes

If this function can be removed, I will remove it later.

I see that the function below also passes some parameters and returns some hints.

Can you point to the lines you are worrying about? I'm pretty sure nothing calls get_upstream. If it's not called, returning anything is not useful at all and can be removed.

(In reply to Kagami [:saschanaz] from comment #16)

I see that the function below also passes some parameters and returns some hints.

Can you point to the lines you are worrying about? I'm pretty sure nothing calls get_upstream. If it's not called, returning anything is not useful at all and can be removed.

Mainly lines 633-634 caused my concern, because this involves the modification of the build system, there are many developers and CI test robots should be using files related to the build system.

(In reply to Ho Cheung from comment #17)

Mainly lines 633-634 caused my concern, because this involves the modification of the build system, there are many developers and CI test robots should be using files related to the build system.

Searchfox shows no caller of get_upstream, and that means there's no way for the developers and CI test robots to call that function. That means line 633-634 never runs, and thus can be removed.

(In reply to Kagami [:saschanaz] from comment #18)

(In reply to Ho Cheung from comment #17)

Mainly lines 633-634 caused my concern, because this involves the modification of the build system, there are many developers and CI test robots should be using files related to the build system.

Searchfox shows no caller of get_upstream, and that means there's no way for the developers and CI test robots to call that function. That means line 633-634 never runs, and thus can be removed.

ok i totally understand, thanks for your explanation

(In reply to Ho Cheung from comment #19)

ok i totally understand, thanks for your explanation

👍

Feel free to ask whenever you have any more doubts!

Remove unused mozversioncontrol functions in code

Depends on D167348

Assignee: nobody → gzyfqh
Status: NEW → ASSIGNED

(In reply to Kagami [:saschanaz] from comment #20)

(In reply to Ho Cheung from comment #19)

ok i totally understand, thanks for your explanation

👍

Feel free to ask whenever you have any more doubts!

Is the reviewed code automatically merged into the code tree? Or do you manually push to the code tree?

Landing is done manually by the reviewer. I'll do that, thanks!

Pushed by krosylight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/99bb9f2c4e3e Remove unused mozversioncontrol functions r=saschanaz,firefox-build-system-reviewers,glandium
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: