Patch 424 Support init/get --no-working-dir and pseudo-applying ...

Title Support init/get --no-working-dir and pseudo-applying ...
Superseder Nosy List galbolle, gh
Related Issues wish: darcs init/get --no-working-directory
View: 431
Status accepted Assigned To

Created on 2010-10-17.14:07:53 by galbolle, last changed 2012-08-02.16:51:57 by kowey. Tracked on DarcsWatch.

File name Status Uploaded Type Edit Remove
allow-init-to-create-working_directory_less-repositories.dpatch galbolle, 2010-10-17.14:07:52 text/x-darcs-patch
allow-init-to-create-working_directory_less-repositories.dpatch galbolle, 2011-04-02.15:01:57 application/x-darcs-patch
no-working.sh kowey, 2011-12-27.19:43:30 application/octet-stream
support-init_get-__no_working_dir-and-pseudo_applying-to-wd_less-repos.dpatch galbolle, 2011-05-12.15:42:31 application/x-darcs-patch
unnamed galbolle, 2010-10-17.14:07:52
unnamed galbolle, 2011-04-02.15:01:57 text/x-darcs-patch
unnamed galbolle, 2011-04-02.15:01:57
unnamed galbolle, 2011-05-12.15:42:31 text/x-darcs-patch
unnamed galbolle, 2011-05-12.15:42:31
See mailing list archives for discussion on individual patches.
msg12754 (view) Author: galbolle Date: 2010-10-17.14:07:52
This is the beginning of a support for "no working repositories".

That is, repositories without a working directory, not non-working repositories.
Except of course, that they are currently not tested or complete in anyway, so
it's non-working after all. Please use, test and report any issues while i add
tests and support for other commands.


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

Sat Oct 16 17:19:16 CEST 2010  Florent Becker <florent.becker@ens-lyon.org>
  * Allow init to create working-directory-less repositories

Sat Oct 16 17:19:38 CEST 2010  Florent Becker <florent.becker@ens-lyon.org>
  * allow get --no-working-dir

Sun Oct 17 16:03:08 CEST 2010  Florent Becker <florent.becker@ens-lyon.org>
  * Support "applying" in working-dir-less repos
msg13179 (view) Author: ganesh Date: 2010-11-21.20:34:31
Sorry for the delay with this. Is there a grumpy-old-man review of the new 
msg13230 (view) Author: gh Date: 2010-11-23.16:28:55
Ganesh, it has been posted on darcs-users:
msg13705 (view) Author: ganesh Date: 2011-02-20.00:13:22
This never made it into screened (but I'm not sure if you wanted it to 
anyway) and is now in conflict.
msg13872 (view) Author: galbolle Date: 2011-04-02.15:01:57
Updated, thanks to rebase.

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

Fri Apr  1 17:51:38 CEST 2011  Florent Becker <florent.becker@ens-lyon.org>
  * Allow init to create working-directory-less repositories

Fri Apr  1 17:59:51 CEST 2011  Florent Becker <florent.becker@ens-lyon.org>
  * allow get --no-working-dir

Sat Apr  2 16:20:17 CEST 2011  Florent Becker <florent.becker@ens-lyon.org>
  * Support "applying" in working-dir-less repos
msg13880 (view) Author: gh Date: 2011-04-03.16:34:12
Here's my review. Legend: (-) are blockers (?) are questions

Patch by patch:

Allow init...
 (-) format file is not properly written
 (?) directory permission code is to make the working dir non writeable, right?
 (?) this patch modifies the Darcs.Commands.Get module just by adding
an import, I think it's an error
 (-) PorNP is a poor name, maybe use PartialOrNot
 (-) same for withWd -> withWorkingDir
 (-) please remove the few useless whitespace hunks of this patch
 (?) Darcs.Repository.State : I can not attest what the changes do

I've tested a little the general behaviour of darcs + this bundle:
 (-) init --no-working does not properly write the format file
 (-) get --no-working-dir does not work (creates repos with working
dirs, does not set "not write" permission on working dir) (I've tested
it against darcs1 and darcs2 patch semantics repositories).

I think you should merge the 3 patches into one, because they are not
that big, and they can't be used independently anyway.

msg14443 (view) Author: galbolle Date: 2011-05-12.15:42:31
Here comes the updated version. Record and friends report that there is
"nothing to [do]" in a working-dir-less repo. They should probably be more
explicit, but I'm not sure if they should rather fail or successfully do

1 patch for repository http://darcs.net:

Mon Apr 25 00:03:02 CEST 2011  Florent Becker <florent.becker@ens-lyon.org>
  * Support init/get --no-working-dir and pseudo-applying to wd-less repos
msg14483 (view) Author: ganesh Date: 2011-06-03.06:08:05
Florent, could you push this to screened if appropriate, or change the 
status if not?
msg14855 (view) Author: kowey Date: 2011-12-27.19:43:30
The code seems right, but I'm not sure this is really working.  I wrote 4 
tests for it, sort of discovering issues as I started writing tests

1. --no-working-dir => really no working dir
2. --no-worknig-dir --with-working-dir (vice-versa): what happens?
3. what happens if you pull some changes into a --no-working-dir?
4. what happens if you record in a --no-working-dir

The first one works.  #2 fails, but it's pretty trivial to fix, not
a blocker. #3 fails bizarrely (cannot read a particular file in
pristine), and I don't think it's the patch's fault (?).
#4 is just me not knowing what *should* happen, but I suspect that
Florent's already thought of it and decided it's a corner case to
not worry about?  May be misremembering

We also seem to have a whole mess of patches in screened that depend on
this one. I'm tempted to say we should just merge this, mark tests
as failing and figure out where to go from there just so we can unblock
the logjam.  Agreed?

Any chance you'd be free to comment, Florent?
Anybody else want to suggest how to get unstuck?

Support init/get --no-working-dir and pseudo-applying to wd-less repos
> hunk ./src/Darcs/Arguments.hs 978
> +useWorkingDir :: DarcsOption
> +useWorkingDir =
> +  DarcsMultipleChoiceOption
> +  [ DarcsNoArgOption [] ["with-working-dir"] UseWorkingDir
> +                         "Create a working directory (normal 
> +    DarcsNoArgOption [] ["no-working-dir"] UseNoWorkingDir
> +                           "Do not create a working directory (bare 

Why not just --working-dir?

> -              do identifyRepositoryFor repository repodir >>= 
> +              do identifyRepositoryFor repository repodir >>= flip 
copyRepository (not $ UseNoWorkingDir `elem` opts)

Perhaps use getBoolFlag instead?
See the R3 test in my proposed test suite attached

> +      then do
> +        when withWorkingDir $ do
> +          debugMessage "Writing working directory contents..."
> +          createPristineDirectoryTree torepository "."
> +        fetchPatchesIfNecessary opts torepository `catchInterrupt`
> +          (putInfo opts $ text "Using lazy repository.")
> hunk ./src/Darcs/Repository.hs 230
> -                   debugMessage "Writing working directory 
> -                   createPristineDirectoryTree torepository "."
> +                   when withWorkingDir $ do
> +                     debugMessage "Writing working directory 
> +                     createPristineDirectoryTree torepository "."

Perhaps a chance for a minor refactor using a let/where on writing
the working dir

> +data RepoProperty = Darcs1_0 | Darcs2 | HashedInventory | NoWorkingDir

> -createRepoFormat fs = RF (map rp2ps [HashedInventory]: maybe2)
> +createRepoFormat fs = RF (map rp2ps (HashedInventory:flags2wd): 
> hunk ./src/Darcs/Repository/Format.hs 101
> +          flags2wd = if UseNoWorkingDir `elem` fs
> +                      then [NoWorkingDir]
> +                      else []

OK, no-working-dir exists now on the same level as hashed.

I have the impression thath the minced format discussion is important

* http://lists.osuosl.org/pipermail/darcs-users/2010-November/025614.html
* http://bugs.darcs.net/issue1647

Maybe: burn the format mechanism to the ground and design a new one

If Darcs 3 is not readyd by the time we need it: use the existing
format mechanism to require that future Darcs understanding the new
format mechanism.

> +      withCurrentDirectory r $ if Quiet `elem` opt
> +                               then runSilently $ apply patch
> +                               else runTolerantly $ apply patch
> +    return (Repo r ropts rf (DarcsRepository t c))
> hunk ./src/Darcs/Repository/Merge.hs 66
> -            mapM_ backupByCopying $ listTouchedFiles 
> +       mapM_ backupByCopying $ listTouchedFiles standard_resolved_pw

> hunk ./src/Darcs/Repository/State.hs 139
> +unrecordedChanges _ r@(Repo _ _ rf _) _
> +  | (formatHas NoWorkingDir rf) = do
> +    IsEq <- return $ workDirLessRepoWitness r
> +    return NilFL
> hunk ./src/Darcs/Repository/State.hs 168
> +-- | Witnesses the fact that in the absence of a working directory, we
> +-- pretend that the working dir updates magically to the tentative 
> +workDirLessRepoWitness :: Repository p C(r u t)
> +                          -> (EqCheck C(u t))
> +workDirLessRepoWitness r@(Repo _ _ rf _) | formatHas NoWorkingDir rf =
> +  unsafeCoerceP IsEq
> +                                         | otherwise = NotEq
> +

I'm going to have to take your word for this one...  I *think* I
understand the intention, which is to make sure that the abscence of
files in the working dir is not treated as an unrecorded diff.
This would be important if we wanted to pull patches, for example,
in the attached 'pull R1b' test case
msg14859 (view) Author: ganesh Date: 2011-12-27.20:11:13
On 27/12/2011 19:43, Eric Kow wrote:

> We also seem to have a whole mess of patches in screened that depend on
> this one. I'm tempted to say we should just merge this, mark tests
> as failing and figure out where to go from there just so we can unblock
> the logjam.  Agreed?

Assuming the only thing that's freshly broken is --no-working-dir, I
think that's fine. We can always disable the feature by default somehow.

msg14889 (view) Author: ganesh Date: 2011-12-28.23:30:25
I've pushed this to unblock other patches. Leaving as in-discussion as a 
reminder to send the tests and perhaps disable the feature.
msg15938 (view) Author: kowey Date: 2012-08-02.16:51:57
Whoops! I didn't notice that the “send the tests” was referring to me (at 
least, I think).  I've screened patch889 accordingly, unfortunately no 
idea what it was all about anymore.

I think we're done with this patch then.
Date User Action Args
2010-10-17 14:07:53galbollecreate
2010-10-17 14:08:55darcswatchsetdarcswatchurl: http://darcswatch.nomeata.de/repo_http:__darcs.net_.html#bundle-9d499d37bb4b62391e27341c3b1048b19ae83aaf
2010-11-02 23:05:51ganeshsetissues: + wish: darcs init/get --no-working-directory
2010-11-21 20:34:31ganeshsetmessages: + msg13179
2010-11-23 16:28:55ghsetmessages: + msg13230
2011-02-20 00:13:22ganeshsetstatus: needs-screening -> followup-requested
assignedto: galbolle
messages: + msg13705
2011-04-02 15:01:57galbollesetfiles: + unnamed, allow-init-to-create-working_directory_less-repositories.dpatch, unnamed
messages: + msg13872
2011-04-03 16:34:13ghsetmessages: + msg13880
2011-05-10 20:06:41darcswatchsetdarcswatchurl: http://darcswatch.nomeata.de/repo_http:__darcs.net_.html#bundle-9d499d37bb4b62391e27341c3b1048b19ae83aaf -> http://darcswatch.nomeata.de/repo_http:__darcs.net_reviewed.html#bundle-9d499d37bb4b62391e27341c3b1048b19ae83aaf
2011-05-12 15:42:31galbollesetfiles: + unnamed, support-init_get-__no_working_dir-and-pseudo_applying-to-wd_less-repos.dpatch, unnamed
messages: + msg14443
title: Allow init to create working-directory-l... (and 2 more) -> Support init/get --no-working-dir and pseudo-applying ...
2011-05-12 15:42:44galbollesetstatus: followup-requested -> needs-screening
2011-05-17 10:59:58galbollesetassignedto: galbolle -> gh
nosy: + gh
2011-06-03 06:08:06ganeshsetassignedto: gh -> galbolle
messages: + msg14483
2011-06-03 17:14:01galbollesetstatus: needs-screening -> needs-review
2011-06-13 08:50:25galbollesetassignedto: galbolle -> gh
2011-12-27 19:43:31koweysetstatus: needs-review -> in-discussion
assignedto: gh ->
messages: + msg14855
files: + no-working.sh
2011-12-27 20:11:14ganeshsetmessages: + msg14859
2011-12-28 23:30:25ganeshsetmessages: + msg14889
2012-08-02 16:51:57koweysetstatus: in-discussion -> accepted
messages: + msg15938