darcs

Patch 1569 add trailing slash to local dir when cloning over ssh

Title add trailing slash to local dir when cloning over ssh
Superseder Nosy List bfrk
Related Issues
Status accepted Assigned To
Milestone

Created on 2017-08-09.11:26:43 by bfrk, last changed 2017-10-26.13:01:32 by gh.

Files
File name Status Uploaded Type Edit Remove
add-trailing-slash-to-local-dir-when-cloning-over-ssh.dpatch bfrk, 2017-08-09.11:26:42 text/x-darcs-patch
fix-cloning-to-ssh-without-specifying-destination-directory.dpatch gh, 2017-08-18.21:09:14 application/octet-stream
See mailing list archives for discussion on individual patches.
Messages
msg19518 (view) Author: bfrk Date: 2017-08-09.11:26:42
1 patch for repository http://darcs.net/screened:

patch a4e18b91089292dc6c7eba74e7106bb805aa511a
Author: Ben Franksen <ben.franksen@online.de>
Date:   Tue May 16 08:33:59 CEST 2017
  * add trailing slash to local dir when cloning over ssh
  
  This change makes it possible to use DARCS_SCP=rsync which can be much
  faster than scp. Without trailing slash on the source dir, rsync
creates the
  local dir inside the target dir which is not what we want here.
Behavior of
  scp is not affected by this change.
Attachments
msg19607 (view) Author: gh Date: 2017-08-18.21:09:14
This looks good (according to
https://codeyarns.com/2016/10/01/trailing-slash-in-rsync/ for instance.)

I'm attaching another patch that fixes a corner case where one does not
specify tyhe destination directory. Without this patch, the directory
created is "local". Now, it is the name of the current directory.
Attachments
msg19610 (view) Author: bfrk Date: 2017-08-19.09:18:37
Unfortunately in this corner case rsync and scp behave differently,
regardless of whether a slash is appended to the target: rsync creates
the repo directly in the home directory, whereas scp creates it in a
subdir. I will think about how to work around that so that the behavior
will be the same in all cases.
msg19739 (view) Author: ganesh Date: 2017-10-12.07:20:43
I'm going to accept the first one as it seems clearly valid, and leave 
this open for discussing gh's followup.

Is rsync actually faster when there's no partial content in the target 
location?
msg19744 (view) Author: bfrk Date: 2017-10-12.09:11:34
> Is rsync actually faster when there's no partial content in the target
> location?

Hm. You have a point here. I had the impression using rsync is a bit
faster, but that could have been cognitive bias. I should really do some
measurements.
msg19756 (view) Author: bfrk Date: 2017-10-16.08:33:47
I made some measurements and the results are much stronger than I
expected. The clone of my current darcs branch to a machine I use at
work takes 18 minutes (!) to complete with the default (scp), while with
DARCS_SCP=rsync it takes a mere 38 seconds.

ben@yuiitsu[1]:.../darcs/current>unset DARCS_SCP                       
               
ben@yuiitsu[1]:.../darcs/current>time darcs clone .
tiber:src/darcs/current1          
Creating local clone...
Transferring clone by SCP...                                 
Cloning and transferring successful.
darcs clone . tiber:src/darcs/current1  10,48s user 9,52s system 1% cpu
18:50,70 total
ben@yuiitsu[1]:.../darcs/current>export DARCS_SCP=rsync                     
ben@yuiitsu[1]:.../darcs/current>time darcs clone . tiber:src/darcs/current2
Creating local clone...
Transferring clone by SCP...                                 
Cloning and transferring successful.
darcs clone . tiber:src/darcs/current2  7,24s user 3,88s system 29% cpu
38,083 total
msg19783 (view) Author: gh Date: 2017-10-26.13:01:31
I am going to push my patch to reviewed since the only difference is
that the source directory to be copied is no longer named "local" but
has the name of the currently cloned repository. The presence of
trailing slash is from before.

v v v v v v v v v v v v v v v v v v v v 

* fix cloning to ssh without specifying destination directory
 Now we can do `darcs clone . domain:` and a directory will
 be created with the name of the current directory instead
 of `local`.

hunk ./src/Darcs/UI/Commands/Clone.hs 199
-         cloneRepository repodir "local" (verbosity ? opts) (useCache ?
opts)
+         mysimplename <- makeRepoName True [] repodir -- give correct
name to local clone
+         cloneRepository repodir mysimplename (verbosity ? opts)
(useCache ? opts)
hunk ./src/Darcs/UI/Commands/Clone.hs 213
-         r <- exec scp (args ++ ["-r", "local/", repo]) (AsIs,AsIs,AsIs)
+         r <- exec scp (args ++ ["-r", mysimplename ++ "/", repo])
(AsIs,AsIs,AsIs)
History
Date User Action Args
2017-08-09 11:26:43bfrkcreate
2017-08-09 11:27:49bfrksetstatus: needs-screening -> needs-review
2017-08-18 21:09:15ghsetfiles: + fix-cloning-to-ssh-without-specifying-destination-directory.dpatch
messages: + msg19607
2017-08-19 09:18:38bfrksetmessages: + msg19610
2017-10-12 07:20:43ganeshsetmessages: + msg19739
2017-10-12 09:11:35bfrksetmessages: + msg19744
2017-10-16 08:33:47bfrksetmessages: + msg19756
2017-10-26 13:01:32ghsetstatus: needs-review -> accepted
messages: + msg19783