Patch 2262 cleanups in and around Darcs.Patch.Depends

Title cleanups in and around Darcs.Patch.Depends
Superseder Nosy List bf
Related Issues
Status needs-review Assigned To

Created on 2022-06-21.16:11:38 by bf, last changed 2022-06-21.16:16:15 by bf.

File name Status Uploaded Type Edit Remove
patch-preview.txt bf, 2022-06-21.16:11:35 text/x-darcs-patch
simplify-taggedintersection.dpatch bf, 2022-06-21.16:11:36 application/x-darcs-patch
See mailing list archives for discussion on individual patches.
msg23035 (view) Author: bf Date: 2022-06-21.16:11:36
Most of them I had in my development branch for a long time (which I
actively use), though they are freshly rebased for cleanup.

The fact that findUncommon previously was stricter than necessary gave me
some headaches. Its refactor in terms of findCommon broke one of the tests
for laziness, and for a long time It didn't occur to me that the breakage
was caused by darcs being *more* lazy, not less, though not in the command
under test but a different one we issued before cutting off access to the
parent repo. I chose to fix the test script, rather than revert the
refactor, since being more lazy wrt inaccessible patch content is a good

16 patches for repository http://darcs.net/screened:

patch b4f21fd8a224fbcdd0b3f760a9bee365be63bba6
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sat Jun 26 16:28:21 CEST 2021
  * simplify taggedIntersection

  This is not a pure refactor: it eliminates one of the branches of the
  original code, namely the one where we used hopefullyM to decide whether the
  content of the tag on the RHS is available. If it was, we did not try to
  reorder patches locally to create a Tagged section for that tag but rather
  gave up on that tag and recursively tried the next Tagged section of the
  RHS. This simply makes no sense and I therefore eliminated that distinction.
  This allowed a few more refactors that make the code more readable.

patch 05cfd390aef7e1c03aea5018cd489ac3d80442c4
Author: Ben Franksen <ben.franksen@online.de>
Date:   Mon Jun 28 09:01:08 CEST 2021
  * D.P.Depends: clarify the meaning of functions local to getUncovered

  We make it clear that they are really graph algorithms, generalizing
  PatchInfo to any type supporting decidable equality; see the comments for
  details. This also removes the Maybe layer for the list of outpoing edges
  (dependencies) associated with a vertex (patch): a non-tag vertex or a tag
  vertex for which we don't have the patch content gets an empty list of

patch 99a2b72c2ba82190a92789ca5500f243ef796468
Author: Ben Franksen <ben.franksen@online.de>
Date:   Mon Jun 28 09:14:20 CEST 2021
  * D.P.Depends: optimize concatenation order in dropDepsIn

  The most common case will be tags that are "almost clean", that is, the
  previous tag we encountered will have few remaining dependencies when we
  encounter the next tag. This means it is more efficient to append the new
  dependencies, rather than prepending them.

patch e64c99c26c29ebca1f02077ddc1ad7dc3e601c0e
Author: Ben Franksen <ben.franksen@online.de>
Date:   Fri Sep 17 16:06:37 CEST 2021
  * D.P.Depends.areUnrelatedRepos: document and inline local function checkit

patch 61b5d3dce9a53211c25e02997e4e654a25f6a847
Author: Ben Franksen <ben.franksen@online.de>
Date:   Tue Jun 14 00:13:28 CEST 2022
  * better explain how splitOnTag works

patch 635428d9c8618664b2c478a413feaea4dffd1875
Author: Ben Franksen <ben.franksen@online.de>
Date:   Thu Jul 22 21:08:29 CEST 2021
  * refactor findCommonWithThem and findUncommon

  They are both special versions of findCommonAndUncommon.

patch 59aa3c5640ac0e1b7174a9c037ff5473e214bf44
Author: Ben Franksen <ben.franksen@online.de>
Date:   Thu Sep 16 10:20:26 CEST 2021
  * findCommonAndUncommon -> findCommon, inline findCommonWithThem, findUncommon

  Instead of specialising findCommon trvially, provide generic conversion
  functions for Forks: dropLeft, dropRight, and dropCommon. However, in most
  cases we immediately pattern match on the result anyway, so it makes more
  sense to just do that with the resulting Fork, using wildcard matches for
  the parts we are not interested in.

patch 539b792edfb1007977b6d80e86b1484324664a47
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sun Jul 18 17:18:55 CEST 2021
  * tests/network/lazy-clone.sh: run with or without cache

  Note that with cache we have one more patch available in the last test.

patch 7488a0738d35be3d73e1e174d6cfe81d23b3a628
Author: Ben Franksen <ben.franksen@online.de>
Date:   Thu Sep 16 08:47:38 CEST 2021
  * tests/network/lazy-clone.sh: weaken requirements in last test

  In this test we make a lazy clone of the first tag, drop the connection to
  the upstream repo, and then expected `darcs log -v` to succeed. This used to
  work, but only in this very special case, and only because of a loss of
  laziness in the definition of Darcs.Patch.Depends.findUncommon. In general,
  a lazy clone may be missing inventories, which makes `darcs log -v` fail if
  the upstream repo is gone and we can't find the inventories in the global
  cache. We now do a `darcs log` before disconnecting upstream in order to
  guarantee that the repo has all inventories. In addition, we test that
  `darcs log -v` works with the full lazy clone, too.

patch 849fa88082d5c87569bf1ae97a9252b0fa45d0bb
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sat Jul  3 07:45:21 CEST 2021
  * refactor removeFromPatchSet using unwrapOneTagged

patch 15d2ed79d68afc5fdf567e58f420477b6171392b
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sat Jul  3 09:10:42 CEST 2021
  * refactor findCommonAndUncommon in terms of a generalized findCommonRL

patch f2dcf2f79c41129178e001ad9b67439e9b8100db
Author: Ben Franksen <ben.franksen@online.de>
Date:   Thu Sep 16 10:47:40 CEST 2021
  * eliminate Darcs.Patch.Ident.merge2FL

  In Darcs.Repository.Merge we already have the precondition that the input
  sequences contain no common patches, so we can as well use 'merge' directly.
  In the implementation of Darcs.Patch.Depends.mergeThem we now use findCommon
  before applying merge to the uncommon parts. This gets us rid of yet another
  function with a confusing name.

patch e09a44a83810b4656d43f4d5ea708a2ad61de524
Author: Ben Franksen <ben.franksen@online.de>
Date:   Thu Sep 16 12:19:06 CEST 2021
  * replace mergeThem with patchSetMerge

  Again, since we always immediately pattern match on the result, we can as
  well match on the result of patchSetMerge directly.

patch f8f697224e336f4a18a3c7a7dd92b78e99ab23b5
Author: Ben Franksen <ben.franksen@online.de>
Date:   Thu Sep 16 12:46:46 CEST 2021
  * refactor patchSetUnion and patchSetIntersection as folds

  This includes a few simplifications: for the intersection of two PatchSets
  we take the common part of findCommon, and for the union we use appendPSFL.
  Note that the simple definition of patchSetUnion as a left fold requires
  that we optimize patchSetMerge for the case where one of the arguments is
  empty, otherwise we loose a lot of efficiency.

patch ad2a3eb9783302f631ee8a2374438a8f8121d5bc
Author: Ben Franksen <ben.franksen@online.de>
Date:   Fri Sep 17 09:58:09 CEST 2021
  * add/extend haddocks in D.P.Depends (includes a few minor layout changes)

patch 2fc8aaf82801046ce346a1b2c2bb480d0ae426fd
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sat Jun 18 20:30:07 CEST 2022
  * fix bug in getUncovered

  Using hopefullyM to return an empty list of explicit dependencies for an
  unavailable tag is obviously wrong in general, that is, unless we already
  know the tag is clean and it is the last patch under consideration. The way
  we use getUncovered, this was (thankfully) not a fatal problem: at worst it
  made getUncovered return too many patch names, which can only lead to
  inefficiencies: a tag may depend on more patches than necessary,
  taggedIntersection may do more work than necessary.
Date User Action Args
2022-06-21 16:11:38bfcreate
2022-06-21 16:16:15bfsetstatus: needs-screening -> needs-review