Issue 2410 --look-for-replaces does not work in real world cases

Title --look-for-replaces does not work in real world cases
Priority Status resolved
Milestone 2.10.0 Resolved in 2.10.0
Superseder Nosy List bf, jlneder
Assigned To

Created on 2014-11-08.20:06:01 by bf, last changed 2015-02-22.01:20:36 by gh.

msg17757 (view) Author: bf Date: 2014-11-08.20:05:58
1. Summarise the issue (what were doing, what went wrong?)

darcs whatsnew --look-for-replaces does not detect any replaces in
real-world cases. For instance try (in the current screened repo)

sed -ri 's/\bopts\b/flags/g' src/Darcs/UI/RemoteApply.hs

and then

darcs whatsnew --look-for-adds

What you get is:

hunk ./src/Darcs/UI/RemoteApply.hs 21
-remoteApply opts repodir bundle
-    = case applyAs opts of
+remoteApply flags repodir bundle
+    = case applyAs flags of
hunk ./src/Darcs/UI/RemoteApply.hs 24
-            | isSshUrl repodir -> applyViaSsh opts (splitSshUrl
repodir) bundle
-            | isHttpUrl repodir -> applyViaUrl opts repodir bundle
-            | otherwise -> applyViaLocal opts repodir bundle
+            | isSshUrl repodir -> applyViaSsh flags (splitSshUrl
repodir) bundle
+            | isHttpUrl repodir -> applyViaUrl flags repodir bundle
+            | otherwise -> applyViaLocal flags repodir bundle
hunk ./src/Darcs/UI/RemoteApply.hs 28
-                   then applyViaSshAndSudo opts (splitSshUrl repodir)
un bundle
+                   then applyViaSshAndSudo flags (splitSshUrl repodir)
un bundle
hunk ./src/Darcs/UI/RemoteApply.hs 40
-applyViaLocal opts repo bundle =
+applyViaLocal flags repo bundle =
hunk ./src/Darcs/UI/RemoteApply.hs 42
-    pipeDoc darcs ("apply":"--all":"--repodir":repo:applyopts opts) bundle
+    pipeDoc darcs ("apply":"--all":"--repodir":repo:applyopts flags) bundle
hunk ./src/Darcs/UI/RemoteApply.hs 45
-applyViaUrl opts repo bundle =
+applyViaUrl flags repo bundle =
hunk ./src/Darcs/UI/RemoteApply.hs 48
-         Nothing -> applyViaLocal opts repo bundle
+         Nothing -> applyViaLocal flags repo bundle
hunk ./src/Darcs/UI/RemoteApply.hs 54
-applyViaSsh opts repo =
-    pipeDocSSH repo [Ssh.remoteDarcs (remoteDarcs opts) ++" apply --all
"++unwords (applyopts opts)++
+applyViaSsh flags repo =
+    pipeDocSSH repo [Ssh.remoteDarcs (remoteDarcs flags) ++" apply
--all "++unwords (applyopts opts)++
hunk ./src/Darcs/UI/RemoteApply.hs 59
-applyViaSshAndSudo opts repo username =
-    pipeDocSSH repo ["sudo -u "++username++" "++Ssh.remoteDarcs
(remoteDarcs opts)++
+applyViaSshAndSudo flags repo username =
+    pipeDocSSH repo ["sudo -u "++username++" "++Ssh.remoteDarcs
(remoteDarcs flags)++
hunk ./src/Darcs/UI/RemoteApply.hs 64
-applyopts opts = ["--debug" | Debug `elem` opts]
+applyopts flags = ["--debug" | Debug `elem` opts]

2. What behaviour were you expecting instead?

A single line

replace ./src/Darcs/UI/RemoteApply.hs [A-Za-z_0-9] opts flags

3. What darcs version are you using? (Try: darcs --exact-version)

2.9.9 (+ 164 patches)
msg17758 (view) Author: bf Date: 2014-11-08.20:08:40
In the test case I wrote darcs whatsnew --look-for-adds but of course I
meant to say darcs whatsnew --look-for-replaces. Too bad the bug tracker
does not allow me to edit the desciption.
msg18160 (view) Author: noreply Date: 2015-02-19.01:03:10
The following patch sent by Guillaume Hoffmann <guillaumh@gmail.com> updated issue issue2410 with
status=resolved;resolvedin=2.10.0 HEAD

* resolve issue2410: detect replaces even with tokens of different lengths 
Ignore-this: 21859ec1e6a7652a68b4409c71dd08cd
msg18161 (view) Author: bf Date: 2015-02-19.01:13:32
It occurred to me to check if this really fixes issue2410. So I replaced
all 'opts' with 'flags' in src/Darcs/UI/Commands/Unrecord.hs using an
editor. Then I ask Darcs about it and got a not-so-.nice answer:

ben@sarun[1]: .../darcs/reviewed > ./dist/build/darcs/darcs whatsnew
darcs: Maybe.fromJust: Nothing

Why did I not do this *before* I pushed to reviewed?
msg18162 (view) Author: bf Date: 2015-02-19.01:15:15
And I meant to add this comment to the patch, not the issue. I should go
to sleep before I do any more stupid things.
Date User Action Args
2014-11-08 20:06:01bfcreate
2014-11-08 20:08:41bfsetmessages: + msg17758
2014-11-18 10:35:51ghsetnosy: + jlneder
milestone: 2.10.0
2015-02-19 01:03:11noreplysetstatus: unknown -> resolved
messages: + msg18160
resolvedin: 2.10.0
2015-02-19 01:13:33bfsetstatus: resolved -> unknown
messages: + msg18161
2015-02-19 01:15:16bfsetmessages: + msg18162
2015-02-22 01:20:36ghsetstatus: unknown -> resolved