Wed, 05 Aug 2020 13:50:49 +0530 merge: rework iteration over mergeresult object in checkpathconflicts()
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 13:50:49 +0530] rev 45342
merge: rework iteration over mergeresult object in checkpathconflicts() Instead of following pattern: ``` for f, (m, args, msg) in mresult.actions.items(): if m == mergestatemod.ACTION_*: ... elif m == mergestatemod.ACTION_*: ... .... ``` We do: ``` for (f, args, msg) in mresult.getaction((mergestatemod.ACTION_*,)): ... for (f, args, msg) in mresult.getaction((mergestatemod.ACTION_*,)): ... .... ``` This makes code bit easier to understand and prevent iterating over actions which we don't need. Differential Revision: https://phab.mercurial-scm.org/D8884
Wed, 05 Aug 2020 13:21:06 +0530 applyupdates: simplfy calculation of number of updated files
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 13:21:06 +0530] rev 45341
applyupdates: simplfy calculation of number of updated files Instead of increasing the `updated` variable each time in a loop, let's use the mergeresult object API to calculate the updated value in one call. Differential Revision: https://phab.mercurial-scm.org/D8883
Mon, 03 Aug 2020 18:08:37 +0530 mergeresult: yield from getactions() instead of buidling a list and returning
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 03 Aug 2020 18:08:37 +0530] rev 45340
mergeresult: yield from getactions() instead of buidling a list and returning Only 7 out of 29 callers change the underlying dict while iterating. So it's better to yield and wrap the 7 callers with `list()`. Differential Revision: https://phab.mercurial-scm.org/D8882
Mon, 03 Aug 2020 18:33:00 +0530 sparse: replace merge action values with mergestate.ACTION_* constants
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 03 Aug 2020 18:33:00 +0530] rev 45339
sparse: replace merge action values with mergestate.ACTION_* constants Having bytestrings like `b'r'` makes it hard to understand for people who don't know the code much or looking at it for the first time. Differential Revision: https://phab.mercurial-scm.org/D8881
Mon, 03 Aug 2020 17:58:18 +0530 mergeresult: implement a len() function and use it
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 03 Aug 2020 17:58:18 +0530] rev 45338
mergeresult: implement a len() function and use it In next patch we will start yielding from `getactions()` instead of building and returning a list. Hence we can no longer rely on that for getting us a length. Differential Revision: https://phab.mercurial-scm.org/D8880
Mon, 03 Aug 2020 17:32:30 +0530 merge: replace use of actions dict with mergeresult object
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 03 Aug 2020 17:32:30 +0530] rev 45337
merge: replace use of actions dict with mergeresult object There are still some places which can be improved by having a dedicated API, this patch for now make all users of actions dict go through the mergeresult object API. Differential Revision: https://phab.mercurial-scm.org/D8879
Mon, 03 Aug 2020 14:54:45 +0530 mergeresult: add sort argument to getactions() method
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 03 Aug 2020 14:54:45 +0530] rev 45336
mergeresult: add sort argument to getactions() method This will be used in next patch. Differential Revision: https://phab.mercurial-scm.org/D8878
Mon, 03 Aug 2020 14:19:06 +0530 merge: pass mergeresult obj in merge._prefetchfiles()
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 03 Aug 2020 14:19:06 +0530] rev 45335
merge: pass mergeresult obj in merge._prefetchfiles() Differential Revision: https://phab.mercurial-scm.org/D8877
Mon, 03 Aug 2020 14:12:13 +0530 merge: pass mergeresult obj instead of actions in applyupdates() (API)
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 03 Aug 2020 14:12:13 +0530] rev 45334
merge: pass mergeresult obj instead of actions in applyupdates() (API) This is similar to past 20 patches or so where we are replacing use of a bare actions dict with a dedicated mergeresult object. The goal is to have a dedicated powerful object instead of a dict while making the code more easier to understand. In past few patches, we have already simplified the code at some places using the newly introduced object. This patch does not updates applyupdates() to use the mergeresult object directly. That will be done in next patch to make things easier to review. Differential Revision: https://phab.mercurial-scm.org/D8876
Mon, 03 Aug 2020 13:30:14 +0530 merge: pass mergeresult obj instead of actions in _checkcollision() (API)
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 03 Aug 2020 13:30:14 +0530] rev 45333
merge: pass mergeresult obj instead of actions in _checkcollision() (API) The goal is to not use the actions dict and replace it with a rich mergeresult object. Differential Revision: https://phab.mercurial-scm.org/D8875
(0) -30000 -10000 -3000 -1000 -300 -100 -10 +10 +100 +300 +1000 +3000 tip