Pulkit Goyal <7895pulkit@gmail.com> [Sat, 25 Jul 2020 01:42:41 +0530] rev 45299
mergeresult: make actionmapping a dict of dict instead of dict of lists
This makes deleting a specific filename entry faster and easier.
Differential Revision: https://phab.mercurial-scm.org/D8837
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 25 Jul 2020 14:44:29 +0530] rev 45298
largefiles: introduce a constant for 'lfmr' action
It's better to use a dedicated constant instead of a string which makes pretty
less sense.
Differential Revision: https://phab.mercurial-scm.org/D8836
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 25 Jul 2020 14:41:20 +0530] rev 45297
largefiles: override merge.emptyactions() to include `lfmr`
I found it weird that we were not already doing this. I encountered this while
using `emptyactions()` in mergeresult() class.
Differential Revision: https://phab.mercurial-scm.org/D8835
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 25 Jul 2020 01:17:35 +0530] rev 45296
merge: unify logic of couple of if-else's in manifestmerge()
Right now manifestmerge() contains very nested if-else conditions and it's not
easy to understand what is happening. I was looking for easy unifications and
found these two.
Differential Revision: https://phab.mercurial-scm.org/D8834
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 24 Jul 2020 23:49:08 +0530] rev 45295
sparse: add comment for an if condition which I tried to refactor
I tried to refactor this if condition and make it part of the if-else above but
tests failed. I decided to add a comment about the check we are doing and why
it's a separate if.
Differential Revision: https://phab.mercurial-scm.org/D8833
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 24 Jul 2020 23:40:07 +0530] rev 45294
mergeactions: use action constants instead of string values
Having constants inplace of strings like 'c', 'cm' etc. makes it easier to
understand the code.
Differential Revision: https://phab.mercurial-scm.org/D8832
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 02 Aug 2020 10:24:28 -0700] rev 45293
merge: use the new action based mapping introduced in mergeresult obj
Before this patch, we have good number of instances of following types:
```
for f, (m, args, msg) in mresult.actions:
if m == ACTION_X:
do_something
```
We iterate over the whole list and then filter for a certain action. Previous
patch introduced a action based mapping in mergeresult object. The above code
now looks like:
```
for f, args, msg in mresult.getactions([ACTION_X, ...]):
do_something
```
Differential Revision: https://phab.mercurial-scm.org/D8831
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 24 Jul 2020 19:48:38 +0530] rev 45292
mergeresult: introduce action -> (filename, data, msg) mapping and related API
Good number of places in code, we iterate over the actions dict which has
filename as keys and filter based on the action.
This patch introduced another mapping which has action as key. This will help in
refactoring the code much more in upcoming patch.
Differential Revision: https://phab.mercurial-scm.org/D8830
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 02 Aug 2020 10:15:55 -0700] rev 45291
mergeresult: rename _actions to _filemapping
This is done because we will be introducing another dict which introduces the
same information but with action name as key.
Differential Revision: https://phab.mercurial-scm.org/D8829
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 24 Jul 2020 19:19:47 +0530] rev 45290
sparse: pass mergeresult obj in sparse.filterupdatesactions() (API)
Not able to see much which can be improved in this function by passing in
mergeresult object but for API consistency and no function directly touching
actions dict, it sounds like a good idea.
Differential Revision: https://phab.mercurial-scm.org/D8828