darcs

Patch 589 resolve issue2052: Implicitly use unifie... (and 2 more)

Title resolve issue2052: Implicitly use unifie... (and 2 more)
Superseder Nosy List owst
Related Issues
Status accepted Assigned To
Milestone

Created on 2011-04-07.01:30:30 by owst, last changed 2011-07-26.20:58:05 by ganesh.

Files
File name Status Uploaded Type Edit Remove
resolve-issue2052_-implicitly-use-unified-diff_-unless-told-not-to_.dpatch owst, 2011-04-07.01:30:30 application/x-darcs-patch
unnamed owst, 2011-04-07.01:30:30 text/x-darcs-patch
unnamed owst, 2011-04-07.01:30:30
See mailing list archives for discussion on individual patches.
Messages
msg13909 (view) Author: owst Date: 2011-04-07.01:30:30
3 patches for repository http://darcs.net/screened:

Thu Apr  7 01:04:36 BST 2011  Owen Stephens <darcs@owenstephens.co.uk>
  * resolve issue2052: Implicitly use unified diff, unless told not to.

Thu Apr  7 02:10:28 BST 2011  Owen Stephens <darcs@owenstephens.co.uk>
  * Add regression test for issue 2052.

Thu Apr  7 02:11:59 BST 2011  Owen Stephens <darcs@owenstephens.co.uk>
  * Fixup failing diff tests, due to fix for issue 2052.
Attachments
msg14002 (view) Author: ganesh Date: 2011-05-08.17:30:53
This is already in screened but darcswatch didn't notice.
msg14463 (view) Author: galbolle Date: 2011-05-26.12:51:14
Thanks, applying, but shouldn't whatsnew and annotate use the same
defaults, or would that break too many automated tools?

resolve issue2052: Implicitly use unified diff, unless told not to.
-------------------------------------------------------------------
Owen Stephens <darcs@owenstephens.co.uk>**20110407000436

hunk ./src/Darcs/Arguments.hs 887
>  
>  unidiff = DarcsMultipleChoiceOption
>            [DarcsNoArgOption ['u'] ["unified"] Unified
> -          "pass -u option to diff",
> +          "pass -u option to diff [DEFAULT]",
>             DarcsNoArgOption  [] ["no-unified"] NonUnified
>            "output patch in diff's dumb format"]
>  

hunk ./src/Darcs/Commands/Diff.hs 39
>                          diffCmdFlag, diffflags, unidiff,
>                           workingRepoDir, fixSubPaths,
>                        )
> -import Darcs.Flags ( isUnified )
> +import Darcs.Flags ( isNotUnified )
>  import Darcs.Patch.PatchInfoAnd ( info )
>  import Darcs.RepoPath ( AbsolutePath, SubPath, toFilePath, sp2fn )
>  import Darcs.Match ( getPartialFirstMatch, getPartialSecondMatch,

ok

hunk ./src/Darcs/Commands/Diff.hs 115
>                                                       workingRepoDir,
storeInMemory]}
>  
>  getDiffOpts :: [DarcsFlag] -> [String]
> -getDiffOpts opts | isUnified opts = "-u" : get_nonU_diff_opts opts
> -                   | otherwise      = get_nonU_diff_opts opts
> +getDiffOpts opts | isNotUnified opts = get_nonU_diff_opts opts
> +                 | otherwise         = "-u" : get_nonU_diff_opts opts
>      where get_nonU_diff_opts (DiffFlags f:fs) = f : get_nonU_diff_opts fs
>            get_nonU_diff_opts (_:fs) = get_nonU_diff_opts fs
>            get_nonU_diff_opts [] = []

hunk ./src/Darcs/Flags.hs 23
>                       compression, remoteDarcs, diffingOpts,
>                       wantExternalMerge, isInteractive,
>                       maxCount, willIgnoreTimes, willRemoveLogFile,
isUnified,
> -                     doHappyForwarding, includeBoring,
> +                     isNotUnified, doHappyForwarding, includeBoring,
>                       doAllowCaseOnly, doAllowWindowsReserved, doReverse,
>                       usePacks,
>                       showChangesOnlyToFiles, rollbackInWorkingDir,

hunk ./src/Darcs/Flags.hs 183
>  isUnified :: [DarcsFlag] -> Bool
>  isUnified = getBoolFlag Unified NonUnified
>  
> +isNotUnified :: [DarcsFlag] -> Bool
> +isNotUnified = getBoolFlag NonUnified Unified
> +

isUnified is still useful for whatsnew and annotate. Shouldn't these
also use the new defaults?


Add regression test for issue 2052.
-----------------------------------
Owen Stephens <darcs@owenstephens.co.uk>**20110407011028

addfile ./tests/issue2052-default-unified-diff.sh

hunk ./tests/issue2052-default-unified-diff.sh 1
> +#!/usr/bin/env bash
> +## Test for issue2052 - Ensure we use unified Diff by default.
> +##
> +## Copyright (C) 2011  Owen Stephens
> +##
> +## Permission is hereby granted, free of charge, to any person
> +## obtaining a copy of this software and associated documentation
> +## files (the "Software"), to deal in the Software without
> +## restriction, including without limitation the rights to use, copy,
> +## modify, merge, publish, distribute, sublicense, and/or sell copies
> +## of the Software, and to permit persons to whom the Software is
> +## furnished to do so, subject to the following conditions:
> +##
> +## The above copyright notice and this permission notice shall be
> +## included in all copies or substantial portions of the Software.
> +##
> +## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> +## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> +## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> +## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> +## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> +## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> +## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +## SOFTWARE.
> +
> +set -ev
> +. lib                           # Load some portability helpers.
> +
> +rm -rf R
> +darcs init --repo R
> +cd R
> +touch a
> +darcs add a
> +darcs record -am 'Add a'
> +
> +echo testing > a
> +
> +test `darcs diff | grep -c "diff -rN -u"` -eq 1
> +test `darcs diff --no-unified | grep -c "diff -rN -u"` -eq 0
> +test `darcs diff --no-unified | grep -c "diff -rN"` -eq 1

ok

Fixup failing diff tests, due to fix for issue 2052.
----------------------------------------------------
Owen Stephens <darcs@owenstephens.co.uk>**20110407011159

ok
History
Date User Action Args
2011-04-07 01:30:30owstcreate
2011-04-07 11:31:50owstlinkpatch588 superseder
2011-05-08 17:30:54ganeshsetstatus: needs-screening -> needs-review
messages: + msg14002
2011-05-26 12:51:14galbollesetstatus: needs-review -> accepted-pending-tests
messages: + msg14463
2011-07-26 20:58:05ganeshsetstatus: accepted-pending-tests -> accepted