New submission from Ben Franksen <[email protected]>: Candidate for resolving issue2732, wait for response there before screening.
1 patch for repository https://darcs.net/screened: patch 38a7277f36b56e2f26e4adbb8cd0394e0cc5cb0e Author: Ben Franksen <[email protected]> Date: Mon Nov 4 19:24:44 CET 2024 * resolve issue2732: generate XML using the xml package This patch is supposed to replace all the manually generated XML with uses of the xml package. ---------- files: patch-preview.txt, resolve-issue2732_-generate-xml-using-the-xml-package_0.dpatch messages: 24102 nosy: bfrk status: needs-screening title: resolve issue2732: generate XML using the xml package __________________________________ Darcs bug tracker <[email protected]> <https://bugs.darcs.net/patch2427> __________________________________
[resolve issue2732: generate XML using the xml package Ben Franksen <[email protected]>**20241104182444 Ignore-this: d7133c3369471936c930b9eb572d5ff2aa5498bc9975e243599756c8a3cd9551c347a4d1d150336f This patch is supposed to replace all the manually generated XML with uses of the xml package. ] hunk ./darcs.cabal 452 + xml >= 1.3.14 && < 1.4, hunk ./src/Darcs/Patch/Info.hs 60 - , unlinesPS hunk ./src/Darcs/Patch/Info.hs 69 -import qualified Data.ByteString as B (length, splitAt, null - ,isPrefixOf, tail, concat - ,empty, head, cons, append +import qualified Data.ByteString as B (length, splitAt + ,isPrefixOf, concat hunk ./src/Darcs/Patch/Info.hs 73 - ( index, head, notElem, all, unpack, pack ) + ( index, notElem, all, unpack, pack ) hunk ./src/Darcs/Patch/Info.hs 77 +import qualified Text.XML.Light as XML hunk ./src/Darcs/Patch/Info.hs 80 - empty, ($$), (<+>), vcat, text, cyanText, blueText, prefix ) + empty, ($$), (<+>), vcat, text, cyanText, blueText ) hunk ./src/Darcs/Patch/Info.hs 319 -toXml :: PatchInfo -> Doc +toXml :: PatchInfo -> XML.Element hunk ./src/Darcs/Patch/Info.hs 322 -toXmlShort :: PatchInfo -> Doc +toXmlShort :: PatchInfo -> XML.Element hunk ./src/Darcs/Patch/Info.hs 325 -toXml' :: Bool -> PatchInfo -> Doc +toXml' :: Bool -> PatchInfo -> XML.Element hunk ./src/Darcs/Patch/Info.hs 327 - text "<patch" - <+> text "author='" <> escapeXMLByteString (_piAuthor pi) <> text "'" - <+> text "date='" <> escapeXMLByteString (_piDate pi) <> text "'" - <+> text "local_date='" <> escapeXML (friendlyD $ _piDate pi) <> text "'" - <+> text "inverted='" <> text (show $ _piLegacyIsInverted pi) <> text "'" - <+> text "hash='" <> text (show $ makePatchname pi) <> text "'>" - $$ indent abstract - $$ text "</patch>" - where - indent = prefix " " - name = text "<name>" <> escapeXMLByteString (_piName pi) <> text "</name>" - abstract | includeComments = name $$ commentsAsXml (_piLog pi) - | otherwise = name - -commentsAsXml :: [B.ByteString] -> Doc -commentsAsXml comments - | B.length comments' > 0 = text "<comment>" - <> escapeXMLByteString comments' - <> text "</comment>" - | otherwise = empty - where comments' = unlinesPS comments + -- We do NOT use the high-level accessors piName, piAuthor, etc because + -- metadataToString does not necessarily produce valid unicode Strings. This + -- is important because most programs that take XML as input for further + -- processing simply fail otherwise. + XML.unode "patch" + ( [ XML.Attr (XML.unqual "author") (unpackPSFromUTF8 (_piAuthor pi)) + , XML.Attr (XML.unqual "date") (piDateString pi) + , XML.Attr (XML.unqual "local_date") (friendlyD $ _piDate pi) + , XML.Attr (XML.unqual "inverted") (show $ _piLegacyIsInverted pi) + , XML.Attr (XML.unqual "hash") (show $ makePatchname pi) + ] + , [ XML.unode "name" $ unpackPSFromUTF8 (_piName pi) ] ++ comments + ) + where + -- note that this is supposed to list junk as well, which is why piLog is not + -- appropriate here + comments + | includeComments = map (XML.unode "comment") (map unpackPSFromUTF8 $ _piLog pi) + | otherwise = [] hunk ./src/Darcs/Patch/Info.hs 353 --- Escape XML characters in a UTF-8 encoded ByteString, and turn it into a Doc. --- The data will be in the Doc as a bytestring. -escapeXMLByteString :: B.ByteString -> Doc -escapeXMLByteString = packedString . bstrReplace '\'' "'" - . bstrReplace '"' """ - . bstrReplace '>' ">" - . bstrReplace '<' "<" - . bstrReplace '&' "&" - hunk ./src/Darcs/Patch/Info.hs 359 -bstrReplace :: Char -> String -> B.ByteString -> B.ByteString -bstrReplace c s bs | B.null bs = B.empty - | otherwise = if BC.head bs == c - then B.append (BC.pack s) - (bstrReplace c s (B.tail bs)) - else B.cons (B.head bs) - (bstrReplace c s (B.tail bs)) - hunk ./src/Darcs/Patch/Summary.hs 17 +import qualified Text.XML.Light as XML hunk ./src/Darcs/Patch/Summary.hs 79 -xmlSummary :: (Summary p, PrimDetails (PrimOf p)) => p wX wY -> Doc -xmlSummary p = text "<summary>" - $$ (vcat . map summChunkToXML . genSummary . conflictedEffect $ p) - $$ text "</summary>" - --- Yuck duplicated code below... -escapeXML :: String -> Doc -escapeXML = text . strReplace '\'' "'" . strReplace '"' """ . - strReplace '>' ">" . strReplace '<' "<" . strReplace '&' "&" - -strReplace :: Char -> String -> String -> String -strReplace _ _ [] = [] -strReplace x y (z:zs) - | x == z = y ++ strReplace x y zs - | otherwise = z : strReplace x y zs --- end yuck duplicated code. +xmlSummary :: (Summary p, PrimDetails (PrimOf p)) => p wX wY -> XML.Element +xmlSummary p = XML.unode "summary" (catMaybes . map summChunkToXML . genSummary . conflictedEffect $ p) hunk ./src/Darcs/Patch/Summary.hs 118 -summChunkToXML :: SummChunk -> Doc +summChunkToXML :: SummChunk -> Maybe XML.Element hunk ./src/Darcs/Patch/Summary.hs 120 - case detail of - SummRmDir f -> xconf c "remove_directory" (xfn f) - SummAddDir f -> xconf c "add_directory" (xfn f) - SummFile SummRm f _ _ _ -> xconf c "remove_file" (xfn f) - SummFile SummAdd f _ _ _ -> xconf c "add_file" (xfn f) - SummFile SummMod f r a x -> xconf c "modify_file" $ xfn f <> xrm r <> xad a <> xrp x - SummMv f1 f2 -> text "<move from=\"" <> xfn f1 - <> text "\" to=\"" <> xfn f2 <> text"\"/>" - SummNone -> empty - where - xconf Okay t x = text ('<':t++">") $$ x $$ text ("</"++t++">") - xconf Conflicted t x = text ('<':t++" conflict='true'>") $$ x $$ text ("</"++t++">") - xconf Duplicated t x = text ('<':t++" duplicate='true'>") $$ x $$ text ("</"++t++">") - xfn = escapeXML . anchorPath "" - -- - xad 0 = empty - xad a = text "<added_lines num='" <> text (show a) <> text "'/>" - xrm 0 = empty - xrm a = text "<removed_lines num='" <> text (show a) <> text "'/>" - xrp 0 = empty - xrp a = text "<replaced_tokens num='" <> text (show a) <> text "'/>" + case detail of + SummRmDir f -> Just $ xconf c "remove_directory" [] [cdata (xfn f)] + SummAddDir f -> Just $ xconf c "add_directory" [] [cdata (xfn f)] + SummFile SummRm f _ _ _ -> Just $ xconf c "remove_file" [] [cdata (xfn f)] + SummFile SummAdd f _ _ _ -> Just $ xconf c "add_file" [] [cdata (xfn f)] + SummFile SummMod f r a x -> + Just $ xconf c "modify_file" [] ([cdata (xfn f)] <> xrm r <> xad a <> xrp x) + SummMv f1 f2 -> + Just $ + xconf c "move" + [XML.Attr (XML.unqual "from") (xfn f1), XML.Attr (XML.unqual "to") (xfn f2)] [] + SummNone -> Nothing + where + xconf :: ConflictState -> String -> [XML.Attr] -> [XML.Content] -> XML.Element + xconf Okay t as cs = XML.unode t (as, cs) + xconf Conflicted t as cs = + XML.unode t (XML.Attr (XML.unqual "conflict") "true":as, cs) + xconf Duplicated t as cs = + XML.unode t (XML.Attr (XML.unqual "suplicate") "true":as, cs) + xfn = anchorPath "" + cdata s = XML.Text (XML.blank_cdata {XML.cdData = s}) + xad 0 = [] + xad a = [XML.Elem $ XML.unode "added_lines" (XML.Attr (XML.unqual "num") (show a))] + xrm 0 = [] + xrm a = [XML.Elem $ XML.unode "removed_lines" (XML.Attr (XML.unqual "num") (show a))] + xrp 0 = [] + xrp a = [XML.Elem $ XML.unode "replaced_tokens" (XML.Attr (XML.unqual "num") (show a))] hunk ./src/Darcs/Repository.hs 26 + , RepoFormat(..) hunk ./src/Darcs/Repository.hs 175 +import Darcs.Repository.Format ( RepoFormat(..) ) hunk ./src/Darcs/UI/Commands/Log.hs 35 +import qualified Text.XML.Light as XML hunk ./src/Darcs/UI/Commands/Log.hs 66 -import Darcs.Patch.Info ( toXml, toXmlShort, showPatchInfo, displayPatchInfo, escapeXML, PatchInfo ) +import Darcs.Patch.Info ( toXml, toXmlShort, showPatchInfo, displayPatchInfo, PatchInfo ) hunk ./src/Darcs/UI/Commands/Log.hs 96 + , fromXml hunk ./src/Darcs/UI/Commands/Log.hs 98 - , insertBeforeLastline hunk ./src/Darcs/UI/Commands/Log.hs 101 - , vcat hunk ./src/Darcs/UI/Commands/Log.hs 376 - | hasXmlOutput opts = xml_changelog + | hasXmlOutput opts = fromXml xml_changelog hunk ./src/Darcs/UI/Commands/Log.hs 390 - xml_changelog = vcat - [ text "<changelog>" - , vcat xml_created_as - , vcat xml_changes - , text "</changelog>" - ] - - xml_with_summary :: Sealed2 (PatchInfoAndG p) -> Doc + xml_changelog = XML.unode "changelog" (xml_created_as ++ xml_changes) + + xml_with_summary :: Sealed2 (PatchInfoAndG p) -> XML.Element hunk ./src/Darcs/UI/Commands/Log.hs 394 - let - deps = getdeps p - xmlDependencies = - text "<explicit_dependencies>" - $$ vcat (map (indent . toXmlShort) deps) - $$ text "</explicit_dependencies>" - summary | deps == [] = indent $ xmlSummary p - | otherwise = indent $ xmlDependencies $$ xmlSummary p - in - insertBeforeLastline (toXml $ info hp) summary + let + deps = getdeps p + xmlDeps = XML.unode "explicit_dependencies" (map toXmlShort deps) + summary | null deps = [xmlSummary p] + | otherwise = [xmlDeps] ++ [xmlSummary p] + xml_info = toXml $ info hp + in + xml_info { XML.elContent = XML.elContent xml_info ++ map XML.Elem summary } hunk ./src/Darcs/UI/Commands/Log.hs 404 + xml_changes :: [XML.Element] hunk ./src/Darcs/UI/Commands/Log.hs 409 + xml_created_as :: [XML.Element] hunk ./src/Darcs/UI/Commands/Log.hs 411 - create :: (AnchoredPath, AnchoredPath) -> Doc + create :: (AnchoredPath, AnchoredPath) -> XML.Element hunk ./src/Darcs/UI/Commands/Log.hs 455 -createdAsXml :: PatchInfo -> (AnchoredPath, AnchoredPath) -> Doc +createdAsXml :: PatchInfo -> (AnchoredPath, AnchoredPath) -> XML.Element hunk ./src/Darcs/UI/Commands/Log.hs 457 - text "<created_as current_name='" - <> escapeXML (displayPath current) - <> text "' original_name='" - <> escapeXML (displayPath createdAs) - <> text "'>" - $$ toXml pinfo - $$ text "</created_as>" + XML.unode "created_as" + ( [ XML.Attr (XML.unqual "current_name") (displayPath current) + , XML.Attr (XML.unqual "original_name") (displayPath createdAs) + ] + , toXml pinfo + ) hunk ./src/Darcs/UI/Commands/ShowRepo.hs 22 -import Data.Char ( toLower, isSpace ) hunk ./src/Darcs/UI/Commands/ShowRepo.hs 23 -import Control.Monad ( when, unless, liftM ) -import Text.Html ( tag, stringToHtml ) +import Data.Maybe ( catMaybes ) +import qualified Text.XML.Light as XML + hunk ./src/Darcs/UI/Commands/ShowRepo.hs 34 + , RepoFormat + , PristineType + , Cache hunk ./src/Darcs/UI/Commands/ShowRepo.hs 47 - ( Pref(Author, Defaultrepo, Prefs) + ( Pref(Author, Defaultrepo) hunk ./src/Darcs/UI/Commands/ShowRepo.hs 50 + , getPrefval hunk ./src/Darcs/UI/Commands/ShowRepo.hs 55 -import qualified Data.ByteString.Char8 as BC (unpack) hunk ./src/Darcs/UI/Commands/ShowRepo.hs 56 +import Darcs.Util.ByteString ( decodeLocale ) hunk ./src/Darcs/UI/Commands/ShowRepo.hs 101 -repoCmd _ opts _ = - let put_mode = if hasXmlOutput opts then showInfoXML else showInfoUsr - in withRepository (useCache ? opts) $ - RepoJob $ \repository -> - actuallyShowRepo (putInfo put_mode) repository opts - --- Some convenience functions to output a labelled text string or an --- XML tag + value (same API). If no value, output is suppressed --- entirely. Borrow some help from Text.Html to perform XML output. - -type ShowInfo = String -> String -> String - -showInfoXML :: ShowInfo -showInfoXML t i = show $ tag (safeTag t) $ stringToHtml i - -safeTag :: String -> String -safeTag [] = [] -safeTag (' ':cs) = safeTag cs -safeTag ('#':cs) = "num_" ++ safeTag cs -safeTag (c:cs) = toLower c : safeTag cs - --- labelled strings: labels are right-aligned at 15 characters; --- subsequent lines in multi-line output are indented accordingly. -showInfoUsr :: ShowInfo -showInfoUsr t i = replicate (15 - length t) ' ' ++ t ++ ": " ++ - intercalate ('\n' : replicate 17 ' ') (lines i) ++ "\n" - -type PutInfo = String -> String -> IO () -putInfo :: ShowInfo -> PutInfo -putInfo m t i = unless (null i) (putStr $ m t i) - --- Primary show-repo operation. Determines ordering of output for --- sub-displays. The `out' argument is one of the above operations to --- output a labelled text string or an XML tag and contained value. - -actuallyShowRepo +repoCmd _ opts _ = do + withRepository (useCache ? opts) $ + RepoJob $ \r -> + getRepoInfo r opts >>= putStr . + if hasXmlOutput opts then + XML.ppElement . XML.unode "repository" + else + showRepoInfo + +data RepoInfo = RepoInfo + { riFormat :: RepoFormat + , riRoot :: String + , riPristineType :: PristineType + , riCache :: Cache + , riPatchIndex :: String + , riTestPref :: Maybe String + , riBinariesfilePref :: Maybe String + , riBoringfilePref :: Maybe String + , riPredistPref :: Maybe String + , riAuthor :: Maybe String + , riDefaultRemote :: Maybe String + , riNumPatches :: Maybe Int + , riWeakHash :: Maybe String + , riMotd :: Maybe String + } + +getRepoInfo hunk ./src/Darcs/UI/Commands/ShowRepo.hs 129 - => PutInfo -> Repository rt p wU wR -> [DarcsFlag] -> IO () -actuallyShowRepo out r opts = do - when (hasXmlOutput opts) (putStr "<repository>\n") - out "Format" $ showInOneLine $ repoFormat r - let loc = repoLocation r - out "Root" loc - out "PristineType" $ show $ repoPristineType r - out "Cache" $ showInOneLine $ repoCache r - piExists <- doesPatchIndexExist loc - piDisabled <- isPatchIndexDisabled loc - out "PatchIndex" $ - case (piExists, piDisabled) of - (_, True) -> "disabled" - (True, False) -> "enabled" - (False, False) -> "enabled, but not yet created" - showRepoPrefs out - when (enumeratePatches opts) (do numPatches r >>= (out "Num Patches" . show) - showXor out r) - showRepoMOTD out r - when (hasXmlOutput opts) (putStr "</repository>\n") - -showXor :: (RepoPatch p, ApplyState p ~ Tree) - => PutInfo -> Repository rt p wU wR -> IO () -showXor out repo = do - theXor <- repoXor repo - out "Weak Hash" (show theXor) - --- Most of the actual elements being displayed are part of the Show --- class; that's fine for a Haskeller, but not for the common user, so --- the routines below work to provide more human-readable information --- regarding the repository elements. + => Repository rt p wU wR -> [DarcsFlag] -> IO RepoInfo +getRepoInfo r opts = do + let riFormat = repoFormat r + let riRoot = repoLocation r + let riPristineType = repoPristineType r + let riCache = repoCache r + piExists <- doesPatchIndexExist riRoot + piDisabled <- isPatchIndexDisabled riRoot + let riPatchIndex = showPatchIndexInfo (piExists, piDisabled) + riBinariesfilePref <- getPrefval "binariesfile" + riBoringfilePref <- getPrefval "boringfile" + riPredistPref <- getPrefval "predist" + riTestPref <- getPrefval "test" + let unlessnull x = if null x then Nothing else Just x + riAuthor <- showPrefList <$> getPreflist Author + riDefaultRemote <- showPrefList <$> getPreflist Defaultrepo + riNumPatches <- + if enumeratePatches opts then + Just . lengthRL . patchSet2RL <$> readPatches r + else + return Nothing + riWeakHash <- + if enumeratePatches opts then Just . show <$> repoXor r else return Nothing + riMotd <- unlessnull . decodeLocale <$> getMotd riRoot + return $ RepoInfo {..} + +instance XML.Node RepoInfo where + node qn RepoInfo {..} = + XML.node qn $ + [ XML.unode "format" $ showInOneLine riFormat + , XML.unode "root" riRoot + , XML.unode "pristinetype" (show riPristineType) + , XML.unode "cache" (showInOneLine riCache) + , XML.unode "patchindex" riPatchIndex + ] + ++ + catMaybes + [ XML.unode "testpref" <$> riTestPref + , XML.unode "binariesfilepref" <$> riBinariesfilePref + , XML.unode "boringfilepref" <$> riBoringfilePref + , XML.unode "predistpref" <$> riPredistPref + , XML.unode "author" <$> riAuthor + , XML.unode "defaultremote" <$> riDefaultRemote + , XML.unode "numpatches" . show <$> riNumPatches + , XML.unode "weakhash" <$> riWeakHash + , XML.unode "motd" <$> riMotd + ] + +showRepoInfo :: RepoInfo -> String +showRepoInfo RepoInfo{..} = + unlines $ + [ out "Format" $ showInOneLine riFormat + , out "Root" riRoot + , out "PristineType" $ show riPristineType + , out "Cache" $ showInOneLine $ riCache + , out "PatchIndex" $ riPatchIndex + ] + ++ catMaybes + [ out "test Pref" <$> riTestPref + , out "binariesfile Pref" <$> riBinariesfilePref + , out "boringfile Pref" <$> riBoringfilePref + , out "predist Pref" <$> riPredistPref + , out "Author" <$> riAuthor + , out "Default Remote" <$> riDefaultRemote + , out "Num Patches" . show <$> riNumPatches + , out "Weak Hash" <$> riWeakHash + , out "MOTD" <$> riMotd + ] + where + -- labelled strings: labels are right-aligned at 15 characters; + -- subsequent lines in multi-line output are indented accordingly. + out t i = + replicate (15 - length t) ' ' ++ t ++ ": " ++ + intercalate ('\n' : replicate 17 ' ') (lines i) + +showPatchIndexInfo :: (Bool, Bool) -> String +showPatchIndexInfo pi = + case pi of + (_, True) -> "disabled" + (True, False) -> "enabled" + (False, False) -> "enabled, but not yet created" hunk ./src/Darcs/UI/Commands/ShowRepo.hs 214 -showRepoPrefs :: PutInfo -> IO () -showRepoPrefs out = do - getPreflist Prefs >>= mapM_ prefOut - getPreflist Author >>= out "Author" . unlines - getPreflist Defaultrepo >>= out "Default Remote" . unlines - where prefOut = uncurry out . (\(p,v) -> (p++" Pref", dropWhile isSpace v)) . break isSpace - -showRepoMOTD :: PutInfo -> Repository rt p wU wR -> IO () -showRepoMOTD out repo = getMotd (repoLocation repo) >>= out "MOTD" . BC.unpack - --- Support routines to provide information used by the PutInfo operations above. - -numPatches :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wU wR -> IO Int -numPatches r = (lengthRL . patchSet2RL) `liftM` readPatches r +showPrefList :: [String] -> Maybe String +showPrefList [] = Nothing +showPrefList ss = Just $ intercalate ", " ss hunk ./src/Darcs/UI/Commands/Util.hs 46 +import qualified Text.XML.Light as XML + hunk ./src/Darcs/UI/Commands/Util.hs 96 - ( Doc, formatWords, ($+$), text, (<+>), hsep, ($$), vcat, vsep - , putDocLn, insertBeforeLastline, prefix + ( Doc, formatWords, ($+$), text, (<+>), hsep, ($$), vsep + , putDocLn, fromXml hunk ./src/Darcs/UI/Commands/Util.hs 152 - put_mode = if x == YesXml - then text "<patches>" $$ - vcat (mapFL (indent . xml_info s) patches) $$ - text "</patches>" - else vsep $ mapFL (showFriendly v s) patches + put_mode = + if x == YesXml + then + fromXml $ XML.unode "patches" $ mapFL (xml_info s) patches + else vsep $ mapFL (showFriendly v s) patches hunk ./src/Darcs/UI/Commands/Util.hs 160 - xml_info YesSummary = xml_with_summary - xml_info NoSummary = toXml . info - - xml_with_summary hp - | Just p <- hopefullyM hp = insertBeforeLastline (toXml $ info hp) - (indent $ xmlSummary p) - xml_with_summary hp = toXml (info hp) - - indent = prefix " " + xml_info YesSummary hp + | Just p <- hopefullyM hp = + let el = toXml (info hp) + in el { XML.elContent = XML.elContent el ++ [XML.Elem (xmlSummary p)] } + xml_info _ hp = toXml (info hp) hunk ./src/Darcs/UI/Commands.hs 61 +import qualified Text.XML.Light as XML hunk ./src/Darcs/UI/Commands.hs 101 - ( Doc, text, (<+>), ($$), ($+$), hsep, vcat + ( Doc, text, (<+>), ($+$), hsep hunk ./src/Darcs/UI/Commands.hs 316 - setEnvCautiously "DARCS_PATCHES_XML" . renderString $ - text "<patches>" $$ - vcat (mapFL (toXml . info) ps) $$ - text "</patches>" + setEnvCautiously + "DARCS_PATCHES_XML" $ + XML.ppElement $ XML.unode "patches" $ mapFL (toXml . info) ps hunk ./src/Darcs/Util/Printer.hs 25 - , insertBeforeLastline hunk ./src/Darcs/Util/Printer.hs 27 + , fromXml hunk ./src/Darcs/Util/Printer.hs 63 +import qualified Text.XML.Light as XML hunk ./src/Darcs/Util/Printer.hs 278 --- TODO try to find another way to do this, it's rather a violation --- of the Doc abstraction -insertBeforeLastline :: Doc -> Doc -> Doc -insertBeforeLastline a b = - case reverse $ map packedString $ linesPS $ renderPS a of - (ll:ls) -> vcat (reverse ls) $$ b $$ ll - [] -> - error "empty Doc given as first argument of Printer.insert_before_last_line" - hunk ./src/Darcs/Util/Printer.hs 529 + +fromXml :: XML.Element -> Doc +fromXml = text . XML.ppElement hunk ./tests/clone.sh 97 -firsthash=`darcs log --xml | grep 'hash=' | sed -e "s/.*hash='//" -e "s/'>//"` +firsthash=$(darcs log --xml | grep 'hash=' | sed -E -e 's/.*hash="([^"]+)".*/\1/') hunk ./tests/issue2136-log_created_as_for_multiple_files.sh 72 - echo "$1" | grep "<created_as current_name='\./$2' original_name='\./$3'>" -C2 | tail -1 | grep "<name>$4</name>" + echo "$1" | grep "<created_as current_name=\"\./$2\" original_name=\"\./$3\">" -C2 | tail -1 | grep "<name>$4</name>" hunk ./tests/issue2136-log_created_as_for_multiple_files.sh 86 -echo "$xmlLog" | not grep "<created_as[^>]*'\./f6'" +echo "$xmlLog" | not grep '<created_as[^>]*"\./f6"' hunk ./tests/legacy-inverted.sh 26 -darcs changes --xml | grep "inverted='True'" +darcs changes --xml | grep "inverted=\"True\"" hunk ./tests/legacy-inverted.sh 33 -darcs changes --xml | not grep "inverted='True'" +darcs changes --xml | not grep "inverted=\"True\"" hunk ./tests/match.sh 60 -hash=`grep hash log | sed -e "s/.*hash='//" -e "s/'.*//"` +hash=$(grep hash log | sed -E -e 's/.*hash="([^"]+)".*/\1/') hunk ./tests/pull.sh 331 -firsthash=`darcs log --xml | grep 'hash=' | sed -e "s/.*hash='//" -e "s/'>//"` +firsthash=`darcs log --xml | grep 'hash=' | sed -E -e 's/.*hash="([^"]+)".*/\1/'` hunk ./tests/rename_shouldnt_affect_prefixes.sh 44 -grep "original_name='./a'" < changes.xml +grep 'original_name="./a"' < changes.xml
resolve-issue2732_-generate-xml-using-the-xml-package_0.dpatch
Description: application/darcs-patch
_______________________________________________ darcs-devel mailing list [email protected] https://lists.darcs.net/mailman/listinfo/darcs-devel
