Patch 2156 merging of local and remote sources

Title merging of local and remote sources
Superseder Nosy List bf
Related Issues
Status accepted Assigned To

Created on 2021-02-21.16:57:53 by bf, last changed 2021-04-03.19:31:29 by ganesh.

File name Status Uploaded Type Edit Remove
add-a-newline-to-the-sources-file-when-cloning.dpatch bf, 2021-02-21.16:57:52 application/x-darcs-patch
patch-preview.txt bf, 2021-02-21.16:57:52 text/x-darcs-patch
unnamed bf, 2021-02-21.16:57:52 text/plain
See mailing list archives for discussion on individual patches.
msg22638 (view) Author: bf Date: 2021-02-21.16:57:52
4 patches for repository http://darcs.net/screened:

patch 2fc2dca9ee0276841de630cb81e3ca0c944d650f
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sat Dec 26 18:45:09 CET 2020
  * add a newline to the sources file when cloning

patch 9bc126b81eee351e1f5db297735746e2be00bdbf
Author: Ben Franksen <ben.franksen@online.de>
Date:   Tue Jan  5 09:39:02 CET 2021
  * clean up merging of local and remote sources when cloning
  This concentrates the logic that determines the new cache/sources when we
  clone a repo into into the unionRemoteCaches function: if the remote repo is
  not a local path, then we add its location as a non-writable repo cache
  entry. Furthermore, the freshly created _toRepo has no sources file anyway,
  so using appendTextFile makes no sense.

patch eb3da80ca5a6d075f01cfcee0b1c07d51705f746
Author: Ben Franksen <ben.franksen@online.de>
Date:   Mon Jan 11 01:37:20 CET 2021
  * unionRemoteCaches -> filterRemoteCaches
  We called unionRemoteCaches with the cache values taken from the source and
  the target repo. Both are the result of calling getCaches. Now, getCaches
  does a lot more than just reading a single sources file. If called with Just
  a remote repo location as second parameter, it merges caches from 6
  different sources: the local repo (at "."), the contents of its sources
  file, the remote repo, the contents of that repo's sources file, the global
  sources file, and (unless --no-cache is in effect) the global cache. This
  means that merging the local and the remote caches is redundant: the remote
  cache already contains all the cache locations of the local cache. This
  motivates removing the first argument and renaming the function.
  Furthermore, some of the design decisions for unionRemoteCaches were, I
  think, misguided. So I also made a semantic change here: the function no
  longer removes network entries for network accessed remote repos. This means
  that we can remove the third parameter, too. My rationale is this: a network
  accessed repo can contain locations in its sources that are essential (that
  is, if the remote repo is itself a lazy clone). Indeed the docs admitted
  that this case isn't handled well. It is true that there is no guarantee
  that remote source repos can be accessed from the local user/machine. But
  this is what 'checkCacheReachability' is for: it blacklists inaccessible
  entries for the current run and advises the user to remove these entries
  from their sources file. IME this scheme works pretty well in practice.

patch e1a2cbf2ea70af254552c2d137ba8e958c0e9f10
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sun Jan 10 10:48:57 CET 2021
  * mkCache: first sort by locatily, then nub
  This is to account for the non-standard Eq instance of CacheLoc. The whole
  point of making Cache abstract and providing a smart constructor is that we
  want the result to be independent of the order of the CacheLoc entries in
  the input list. If we first nub and then sort, then the original order
  matters: it determines whether in the result two equal (==) CacheLoc will be
  Writable or NotWritable.
msg22698 (view) Author: ganesh Date: 2021-04-03.16:37:32
OK (I didn't read the code in detail but the descriptions sound sensible)
Date User Action Args
2021-02-21 16:57:53bfcreate
2021-02-21 19:41:25bfsetstatus: needs-screening -> needs-review
2021-04-03 16:37:32ganeshsetstatus: needs-review -> accepted-pending-tests
messages: + msg22698
2021-04-03 19:31:29ganeshsetstatus: accepted-pending-tests -> accepted