Wed, 29 Jul 2020 15:49:44 +0200 rhg: simplify `FindRootError` handling
Antoine Cezar <antoine.cezar@octobus.net> [Wed, 29 Jul 2020 15:49:44 +0200] rev 45363
rhg: simplify `FindRootError` handling Differential Revision: https://phab.mercurial-scm.org/D8867
Wed, 29 Jul 2020 10:26:17 +0200 rhg: add buffered stdout writing possibility
Antoine Cezar <antoine.cezar@octobus.net> [Wed, 29 Jul 2020 10:26:17 +0200] rev 45362
rhg: add buffered stdout writing possibility Improve batch stdout writing performance. At some point line buffered output should be introduced. Differential Revision: https://phab.mercurial-scm.org/D8866
Mon, 20 Jul 2020 18:14:52 +0200 rhg: ask the error message from `CommandError`
Antoine Cezar <antoine.cezar@octobus.net> [Mon, 20 Jul 2020 18:14:52 +0200] rev 45361
rhg: ask the error message from `CommandError` Avoid repeating the display of the same error messages in different commands. Differential Revision: https://phab.mercurial-scm.org/D8865
Tue, 21 Jul 2020 10:39:30 +0200 rhg: Do not return error when when we really mean ok in commands
Antoine Cezar <antoine.cezar@octobus.net> [Tue, 21 Jul 2020 10:39:30 +0200] rev 45360
rhg: Do not return error when when we really mean ok in commands Before when a command was successfull `Err(CommandErrorKind::Ok.into())` was returned which is an oxymoron. Using `Ok(())` when everything is ok seems more appropriate. Differential Revision: https://phab.mercurial-scm.org/D8864
Sat, 08 Aug 2020 12:52:39 -0700 hg-core: define a `ListTrackedFiles` `Operation`
Antoine Cezar <antoine.cezar@octobus.net> [Sat, 08 Aug 2020 12:52:39 -0700] rev 45359
hg-core: define a `ListTrackedFiles` `Operation` List files under Mercurial control in the working directory. Differential Revision: https://phab.mercurial-scm.org/D8863
Wed, 29 Jul 2020 10:08:09 +0200 hg-core: remove the `Operation` trait
Antoine Cezar <antoine.cezar@octobus.net> [Wed, 29 Jul 2020 10:08:09 +0200] rev 45358
hg-core: remove the `Operation` trait There is no way to currently define a trait which can both return references to `self` and to passed data, which is what we would need. Generic Associated Types may fix this and allow us to have a unified interface. See: rust #44265 Differential Revision: https://phab.mercurial-scm.org/D8862
Tue, 04 Aug 2020 10:59:43 +0200 hg-core: make parse_dirstate return references rather than update hashmaps
Antoine Cezar <antoine.cezar@octobus.net> [Tue, 04 Aug 2020 10:59:43 +0200] rev 45357
hg-core: make parse_dirstate return references rather than update hashmaps Returing a vec is faster than updating a hashmap when the hashmap is not needed like in `hg files` which just list tracked files. Returning references avoid copying data when not needed improving performence for large repositories. Differential Revision: https://phab.mercurial-scm.org/D8861
Fri, 07 Aug 2020 18:01:48 +0530 repository: introduce constant for internal phase repo requirement and use it
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 07 Aug 2020 18:01:48 +0530] rev 45356
repository: introduce constant for internal phase repo requirement and use it In future we will like to much cleaner logic around which requirement is for working copy and which can go in store. To start with that, we first need to de-clutter the requirement values spread around and replace them with constants. Differential Revision: https://phab.mercurial-scm.org/D8912
Sat, 08 Aug 2020 10:06:32 -0700 repository: introduce constant for sparse repo requirement and use it
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 08 Aug 2020 10:06:32 -0700] rev 45355
repository: introduce constant for sparse repo requirement and use it In future we will like to much cleaner logic around which requirement is for working copy and which can go in store. To start with that, we first need to de-clutter the requirement values spread around and replace them with constants. Differential Revision: https://phab.mercurial-scm.org/D8911
Fri, 07 Aug 2020 16:02:13 +0530 localrepo: refactor `.hg/requires` reading logic in separate function
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 07 Aug 2020 16:02:13 +0530] rev 45354
localrepo: refactor `.hg/requires` reading logic in separate function In an upcoming patch, we will be reusing this to read `.hg/store/requires`, so let's separate it in a different function before. Differential Revision: https://phab.mercurial-scm.org/D8910
Fri, 07 Aug 2020 15:52:52 +0530 localrepo: refactor logic to calculate sharedvfs in separate fn
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 07 Aug 2020 15:52:52 +0530] rev 45353
localrepo: refactor logic to calculate sharedvfs in separate fn We will be reusing this in an upcoming patch, so better to refactor it into a separate function. Also the underlying handling deserves a function of it's own. Differential Revision: https://phab.mercurial-scm.org/D8909
Sun, 02 Aug 2020 17:40:35 +0200 keepalive: Do not append _rbuf if _raw_readinto exists (issue6356) stable
Cédric Krier <ced@b2ck.com> [Sun, 02 Aug 2020 17:40:35 +0200] rev 45352
keepalive: Do not append _rbuf if _raw_readinto exists (issue6356) The readline method append to the chunks the content of the _rbuf then there is a loop that call _raw_read which on Python3 call readinto. But the readinto version in mercurial append again the _rbuf content. So this creates the duplicate content. This does not happen in Python2 because _raw_read does not call readinto. Differential Revision: https://phab.mercurial-scm.org/D8859
Sat, 08 Aug 2020 10:13:37 -0700 store: refactor space delimited list to proper data structure
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 08 Aug 2020 10:13:37 -0700] rev 45351
store: refactor space delimited list to proper data structure There is no good reason why are having a space delimited list and then using `.split()` to get the actual list. Let's convert this into a proper collection. Differential Revision: https://phab.mercurial-scm.org/D8908
Fri, 07 Aug 2020 21:59:43 -0700 makefile: stop setting unused HGEXTDIR variable during osx build
Martin von Zweigbergk <martinvonz@google.com> [Fri, 07 Aug 2020 21:59:43 -0700] rev 45350
makefile: stop setting unused HGEXTDIR variable during osx build The variable was added in a38ed42cd23c (osx: include chg by default, 2017-03-20), but I can't find any others references to the variable in that commit or in any other commits. Differential Revision: https://phab.mercurial-scm.org/D8915
Thu, 06 Aug 2020 13:51:43 +0530 merge: drop commitinfo argument to applyupdates (API)
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 06 Aug 2020 13:51:43 +0530] rev 45349
merge: drop commitinfo argument to applyupdates (API) We now pass the mergeresult object and hence there is no need to have a separate commitinfo argument as the required info is present in mergeresult object. Differential Revision: https://phab.mercurial-scm.org/D8904
Thu, 06 Aug 2020 13:27:38 +0530 merge: remove emptyactions() and use collections.defaultdict(list) instead
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 06 Aug 2020 13:27:38 +0530] rev 45348
merge: remove emptyactions() and use collections.defaultdict(list) instead emptyactions() used to return a dict which was populated and passed into applyupdates(). However, with recent changes, we no longer pass a plain dict, instead we pass the mergeresult object. There was only one usage of emptyactions and that too inside mergeresult object. That usage is replaced with collections.defaultdict(list) instead. Not sure why we were not using collections.defaultdict(list) from the beginning. Differential Revision: https://phab.mercurial-scm.org/D8903
Wed, 05 Aug 2020 16:52:51 +0530 merge: pass mergeresult obj in _forgetremoved() (API)
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 16:52:51 +0530] rev 45347
merge: pass mergeresult obj in _forgetremoved() (API) Instead of returning a dict of actions and then updating it, let's pass the object directly and update it there. This makes `updateactions()` on mergeresult unused and this patch removes that. After this patch, we have couple of methods left on mergeresult class which still exposes the internal dict based action storage. Differential Revision: https://phab.mercurial-scm.org/D8889
Wed, 05 Aug 2020 16:00:25 +0530 mergeresult: introduce filemap() which yields filename based mapping
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 16:00:25 +0530] rev 45346
mergeresult: introduce filemap() which yields filename based mapping We wanted to remove `actions` as this was leaking how we store things internally and was direct access to one of the member. This introduces filemap() which yields a map of `filename` -> `action, args, msg`. `mergeresult.actions` has been deleted as it's no longer required. Differential Revision: https://phab.mercurial-scm.org/D8888
Wed, 05 Aug 2020 15:41:23 +0530 mergeresult: add `files()` and use it
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 15:41:23 +0530] rev 45345
mergeresult: add `files()` and use it `files()` will return a list of files on which an action needs to be performed. This is a step to stop exposing the underlying map to the user of this object. Differential Revision: https://phab.mercurial-scm.org/D8887
Wed, 05 Aug 2020 15:37:26 +0530 mergeresult: introduce getfile() and use it where required
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 15:37:26 +0530] rev 45344
mergeresult: introduce getfile() and use it where required We want to hide the underlying dictionary from the users and provide API for valid and sane use cases. Differential Revision: https://phab.mercurial-scm.org/D8886
Wed, 05 Aug 2020 14:03:59 +0530 merge: use ACTION_* constants instead of values in _filternarrowactions()
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 05 Aug 2020 14:03:59 +0530] rev 45343
merge: use ACTION_* constants instead of values in _filternarrowactions() It makes easier to check what noconflicttypes are and which are not included. I hope we can have a state where we always use ACTION_* constants instead of these values which are very hard to understand. Differential Revision: https://phab.mercurial-scm.org/D8885
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
(0) -30000 -10000 -3000 -1000 -300 -100 -50 -30 +30 +50 +100 +300 +1000 +3000 tip