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
|