darcs

Patch 878 darks patch: Refactor --patch X to use same code as --match 'name X'

Title darks patch: Refactor --patch X to use same code as --match 'name X'
Superseder Nosy List lukeworth
Related Issues
Status accepted Assigned To
Milestone

Created on 2012-07-16.05:19:23 by lukeworth, last changed 2012-07-20.10:38:04 by owst.

See mailing list archives for discussion on individual patches.
Messages
msg15872 (view) Author: lukeworth Date: 2012-07-16.05:19:21
My first patch. Not in response to any issue, but joins some duplicated code and renames some functions to make better sense.

1 patch for repository http://darcs.net:

Sun Jul 15 11:51:56 EST 2012  luke@worth.id.au
  * Refactor --patch X to use same code as --match 'name X'


New patches:

[Refactor --patch X to use same code as --match 'name X'
luke@worth.id.au**20120715015156
 Ignore-this: bd1322dc49dd3ad07b16cf752803bd20
] hunk ./src/Darcs/Patch/Match.hs 421
 getMatchPattern (SeveralPattern m:_) = Just m
 getMatchPattern (_:fs) = getMatchPattern fs
 
-tagmatch :: String -> Matcher p
+tagmatch :: RepoPatch p => String -> Matcher p
 tagmatch r = makeMatcher ("tag-name "++r) tm
     where tm (Sealed2 p) =
               let n = justName (info p) in
hunk ./src/Darcs/Patch/Match.hs 427
               "TAG " `isPrefixOf` n && isJust (matchRegex (mkRegex r) $ drop 4 n)
 
-mymatch :: String -> Matcher p
-mymatch r = makeMatcher ("patch-name "++r) mm
-    where mm (Sealed2 p) = isJust . matchRegex (mkRegex r) . justName . info $ p
+mymatch :: RepoPatch p => String -> Matcher p
+mymatch r = makeMatcher ("patch-name "++r) (mymatch_ r)
 
 
 -- | strictJust is a strict version of the Just constructor, used to ensure
replace ./src/Darcs/Patch/Match.hs [A-Za-z_0-9] mymatch patchmatch
replace ./src/Darcs/Patch/Match.hs [A-Za-z_0-9] mymatch_ namematch

Context:

[reintroduce GNUmakefile for make tags
Guillaume Hoffmann <guillaumh@gmail.com>**20120714221935
 Ignore-this: 76bf772bc718b66eb648ac6e883e902c
] 
[remove website and manual
Guillaume Hoffmann <guillaumh@gmail.com>**20120705205712
 Ignore-this: 9b3f3aa84387f15066950986169babd5
] 
[rm no longer used UI flags AnyOrder and NoUpdateWorking
Guillaume Hoffmann <guillaumh@gmail.com>**20120712184402
 Ignore-this: 3c1c4136f725c045b9315c2edb0fe1c1
] 
[Fix an implementation style wart in Replace, from fix for issue2125.
Owen Stephens <darcs@owenstephens.co.uk>**20120710153936
 Ignore-this: aef94d42310d2c3cbd4f1a49a5ab9b9d
] 
[update darcs wiki repository url
Guillaume Hoffmann <guillaumh@gmail.com>**20120709224932
 Ignore-this: a7b6e966d79a3ebde97c9a1235beb589
] 
[remove now gone documentation files from darcs.cabal
Guillaume Hoffmann <guillaumh@gmail.com>**20120708171034
 Ignore-this: 4316f0694bd6d9ab4627d6420c7f4057
] 
[document command flags in darcs help markdown
Guillaume Hoffmann <guillaumh@gmail.com>**20120707221502
 Ignore-this: e0073fab05963823303e69d584ec0d63
] 
[extend record command help with data from manual
Guillaume Hoffmann <guillaumh@gmail.com>**20120707215915
 Ignore-this: bfe7e77292ed28d22903f099a91cf707
] 
[complete send command help with data from manual
Guillaume Hoffmann <guillaumh@gmail.com>**20120707164654
 Ignore-this: b626e00e9462d956bb364c0733b5dfbd
] 
[extend pull command help with data from manual
Guillaume Hoffmann <guillaumh@gmail.com>**20120707164633
 Ignore-this: ba529e92289e62ed995f5dc9783f144f
] 
[extend apply command help with data from manual
Guillaume Hoffmann <guillaumh@gmail.com>**20120707164624
 Ignore-this: a8e116aae541496907132688cd7f6cd
] 
[copy --creator-hash flag help from manual to annotate command help
Guillaume Hoffmann <guillaumh@gmail.com>**20120707164602
 Ignore-this: 930bc8b9d8a93e273a89ac607ad16e86
] 
[extend push command help with data from manual
Guillaume Hoffmann <guillaumh@gmail.com>**20120707163925
 Ignore-this: 61207bc5fd97c97d48f1a5d73362bcf8
] 
[introduce darcs help markdown, convert help messages to markdown
Guillaume Hoffmann <guillaumh@gmail.com>**20120707015039
 Ignore-this: 8be4bb75724b1a2b95572de7fdff518f
] 
[update help strings of --hashed and --darcs-2 
Guillaume Hoffmann <guillaumh@gmail.com>**20120704192050
 Ignore-this: 2109f5da554e5a4a1f8c1a6f1bec6d86
] 
[move functions from Darcs.Utils to Repository and UI modules
Guillaume Hoffmann <guillaumh@gmail.com>**20120702191914
 Ignore-this: 2b44a3676c8342d88998385c5eb2c97f
] 
[accept issue2203
Owen Stephens <darcs@owenstephens.co.uk>**20120606135509
 Ignore-this: 98a7294e03d9ed856d226a92e4339fa9
] 
[Remove reference to old patch-name flag in amend help
Owen Stephens <darcs@owenstephens.co.uk>**20120627104810
 Ignore-this: a084bcf7bff36c43a24184950b15c740
] 
[delete remaining tests for rollback --record, fix pull.sh
Guillaume Hoffmann <guillaumh@gmail.com>**20120702151415
 Ignore-this: a97385d0ea9a6b98c43fbcb4826bb00e
] 
[Simplify issue2200 test (Fails on Mac otherwise)
Eric Kow <kowey@darcs.net>**20120701172244
 Ignore-this: 1833bf31a021f06a1c1418a6dc9a44f6
] 
[use nubSort function from data-ordlist instead of own
Guillaume Hoffmann <guillaumh@gmail.com>**20120624012933
 Ignore-this: 8dcc4835901ab049b74b456c0b0c4320
] 
[remove rollback --record functionality
Guillaume Hoffmann <guillaumh@gmail.com>**20120622203838
 Ignore-this: f0fc37a86176bb2ddf61fca8afdb543f
] 
[move Darcs.Witnesses to Darcs.Patch.Witnesses
Guillaume Hoffmann <guillaumh@gmail.com>**20120621044810
 Ignore-this: 1a491cc01ef880a7489198a784e0e94c
] 
[Hlint suggestion.
Alejandro Gadea <alex.aegf@gmail.com>**20120608180910
 Ignore-this: fbfe6cc933e091d43fc3cf44aa810b57
] 
[Eric no longer at University of Brighton.
Eric Kow <kowey@darcs.net>**20120526111447
 Ignore-this: 72c678816da734f5c536d5f347edfcf
] 
[remove redundant hashed_inventory creation during get
Guillaume Hoffmann <guillaumh@gmail.com>**20120608152716
 Ignore-this: 43cf1592ee6d162286bb399c03ff2d8f
] 
[move Darcs.Flags to Darcs.UI.Flags
Guillaume Hoffmann <guillaumh@gmail.com>**20120606230753
 Ignore-this: 165974b3be0688f966937c8fcd69bb23
] 
[remove Darcs.Flags import from all Darcs.Repository* modules
Guillaume Hoffmann <guillaumh@gmail.com>**20120606230732
 Ignore-this: d547a633fd9cf89e5ed32540f886a99a
] 
[remove Darcs.Flags import from Darcs.Repository.State
Guillaume Hoffmann <guillaumh@gmail.com>**20120605173335
 Ignore-this: 6c50604b5f3141a98dde6cbabb44d1a7
] 
[remove Darcs.Flags import from Darcs.Repository.Motd
Guillaume Hoffmann <guillaumh@gmail.com>**20120605150734
 Ignore-this: 1d45d0508014e8a3e795a1407af64090
] 
[remove Darcs.Flags import from Darcs.Repository.Prefs
Guillaume Hoffmann <guillaumh@gmail.com>**20120605145951
 Ignore-this: fa26c44fa9d8fb35ba6d16759385ed3c
] 
[remove Darcs.Flags import from Darcs.Repository.Format
Guillaume Hoffmann <guillaumh@gmail.com>**20120605135203
 Ignore-this: 392a975378ccaf6cbf9dcbbfed4e60e8
] 
[remove Darcs.Flags import from Darcs.Repository.Test
Guillaume Hoffmann <guillaumh@gmail.com>**20120605004907
 Ignore-this: 9a050a84d39f87037129d94c1f133b78
] 
[remove DarcsFlag from Repository datatype, use Darcs.Repository.Flags more
Guillaume Hoffmann <guillaumh@gmail.com>**20120605000222
 Ignore-this: fe1cb178f109a19e11cd5e5febda8bd0
] 
[introduce Darcs.Repository.Flags and start using it
Guillaume Hoffmann <guillaumh@gmail.com>**20120602163726
 Ignore-this: 71b0a709a839d1620882d1313e471c57
] 
[remove Darcs.Patch.Match dependency on Darcs.Flag
Guillaume Hoffmann <guillaumh@gmail.com>**20120602163316
 Ignore-this: 22a3fc88d7402fe84931ba81c59a5369
] 
[explicit imports for Darcs.Patch.Match
Guillaume Hoffmann <guillaumh@gmail.com>**20120602163254
 Ignore-this: 5c008202c641b13c79b7a55ea28202cc
] 
[finer-grained import for Darcs.Repository.Match
Guillaume Hoffmann <guillaumh@gmail.com>**20120531222613
 Ignore-this: 379b999119959b57bd7a31c45a158cea
] 
[fix compilation on non-windows oses after Patchy change
Guillaume Hoffmann <guillaumh@gmail.com>**20120531222412
 Ignore-this: 8563539bd6ef3f8be351a16708cd621c
] 
[enable 8bit escaping in issue1739 test
Owen Stephens <darcs@owenstephens.co.uk>**20120530160936
 Ignore-this: 9b27d732836efda3e8b784e8cc4fbbf7
] 
[Darcs.Patch.Invert: missing newline at end of file
Ganesh Sittampalam <ganesh@earth.li>**20120517173634
 Ignore-this: 7be8aefc7a16a186b260c4f404ff2185
] 
[add comment about a dubious looking bit of code
Ganesh Sittampalam <ganesh@earth.li>**20120516055257
 Ignore-this: 469cd7ecd7730731fe6b7654fff123d0
] 
[make Patchy smaller
Ganesh Sittampalam <ganesh@earth.li>**20120531174828
 Ignore-this: 95e60ad356b0504348cd92c540636fe7
 Reading, printing and inspecting the internals are now separate
 which makes it easier to see what functionality is needed where.
 Patchy is left as a core: Apply, Commute and Invert.
 
] 
[use RepoPatch instead of Patchy constraint for matchers
Ganesh Sittampalam <ganesh@earth.li>**20120531174758
 Ignore-this: bcd637ba902987d99b9a1d3cabf08670
 This isn't required by the code, but it helps to guard against accidentally
 using the wrong kind of patch.
 
] 
[relax type signature
Ganesh Sittampalam <ganesh@earth.li>**20120531174736
 Ignore-this: f61d1f3f2083ed5114c5a57c040d0e86
] 
[add merge combinators
Ganesh Sittampalam <ganesh@earth.li>**20120517173539
 Ignore-this: a9913d32245eba21a3babc69ca73c60d
] 
[add utility function for changing type of a ListFormat
Ganesh Sittampalam <ganesh@earth.li>**20120517172017
 Ignore-this: 34dbb4f6d7295365bab18c8c16c94554
] 
[add commutation combinators for Named
Ganesh Sittampalam <ganesh@earth.li>**20120517165535
 Ignore-this: 3475d2df124c9a42379b8f6a68dd55c7
] 
[drop unnecessary superclasses and move Invert FL/RL instances
Ganesh Sittampalam <ganesh@earth.li>**20120517165501
 Ignore-this: fa44da251502982169d455a012394554
] 
[break CommuteFn infrastructure out into separate module
Ganesh Sittampalam <ganesh@earth.li>**20120517164318
 Ignore-this: a76f48e5fb880853914f56e154df86bc
] 
[add helper class for debugging patches
Ganesh Sittampalam <ganesh@earth.li>**20120516173647
 Ignore-this: 4c3e27e9c0228c4180fdaec8e5b6f361
] 
[drop MyEq superclass from Patchy
Ganesh Sittampalam <ganesh@earth.li>**20120516070017
 Ignore-this: eedb9d386640c731399379828a68ebef
 The notion of equality on patches isn't completely obvious,
 because it might be structural equality or equality under commutations
 (e.g. for lists of patches).
 So it's better to be explicit about when we need it.
 It moves into PrimPatch instead for now, for V1 and V2 commutation,
 but RealPatch doesn't need it.
 
] 
[get rid of joinPatches
Ganesh Sittampalam <ganesh@earth.li>**20120516060012
 Ignore-this: 26661d83a244310bb0b4173a230679b3
] 
[drop some unnecessary Patchy constraints
Ganesh Sittampalam <ganesh@earth.li>**20120515205250
 Ignore-this: aa04a0bb6599102c1ee119323ab2b865
] 
[move Darcs.ProgressPatches to Darcs.Patch.Progress
Guillaume Hoffmann <guillaumh@gmail.com>**20120531190221
 Ignore-this: 97816f412e351740f7022f76a077b3e1
] 
[move MonadProgress into Darcs.Patch
Guillaume Hoffmann <guillaumh@gmail.com>**20120531185625
 Ignore-this: 970a62922f27d2d566b95ae07bf5f1e5
] 
[move formatText out from GZCRCs into Utils
Ganesh Sittampalam <ganesh@earth.li>**20120531184012
 Ignore-this: 6a3c462471e3452fa8a97b0fa862f149
] 
[move Compat and Diff to Repository, start taking apart Darcs.Utils
Guillaume Hoffmann <guillaumh@gmail.com>**20120531174737
 Ignore-this: a9c39cc763029d8c4271eeb2f81bb2a8
] 
[fix warning that was showing up on Windows
Ganesh Sittampalam <ganesh@earth.li>**20120531174514
 Ignore-this: 3cf3534fad395288ced6cad9e30c18b1
] 
[Fix failing test due to modified replace behaviour
Owen Stephens <darcs@owenstephens.co.uk>**20120529143147
 Ignore-this: f08bb12b2ab17e972e03c7361da94bbe
] 
[resolve issue2200: darcs replace complains if no filepaths given
Owen Stephens <darcs@owenstephens.co.uk>**20120530235526
 Ignore-this: 345794a9236df23152ccfc37a2f557ca
] 
[fix build on Windows
Ganesh Sittampalam <ganesh@earth.li>**20120530213331
 Ignore-this: 376643bf63b4da7a022bc2786f4068dd
] 
[accept issue2199: darcs get --tag gets too much
Ganesh Sittampalam <ganesh@earth.li>**20120528164525
 Ignore-this: 8c138a80c294e6181a3ef9250593fa31
] 
[move Email External PrintPatch and SelectChange into UI
Guillaume Hoffmann <guillaumh@gmail.com>**20120529193452
 Ignore-this: fc37c49d3d01fd2f169a1d0a2c8b7898
] 
[move function getTermNColors from D.External to D.ColorPrinter
Guillaume Hoffmann <guillaumh@gmail.com>**20120529184426
 Ignore-this: 5b77a605de7f4aceee78bd1d7f2371bf
] 
[move RemoteApply to UI
Guillaume Hoffmann <guillaumh@gmail.com>**20120529184350
 Ignore-this: 1b197d2f32fbff3e235739d934aecb3c
] 
[split Match in Repository-specific and Patch-specific modules
Guillaume Hoffmann <guillaumh@gmail.com>**20120529165742
 Ignore-this: eb14bd11c09f426ee49df1e36f8e366e
] 
[split External into Repository-specific and unspecific modules
Guillaume Hoffmann <guillaumh@gmail.com>**20120529153419
 Ignore-this: a5a88434a46067e9ae3813d24967b4c2
] 
[move Resolution into Repository
Guillaume Hoffmann <guillaumh@gmail.com>**20120529141328
 Ignore-this: bbbb77f6f3debbdb3bff06ec90700286
] 
[introduce and populate the UI module, move Annotate into Patch
Guillaume Hoffmann <guillaumh@gmail.com>**20120529141238
 Ignore-this: 2dddf53d30c8ff62e11db712c312543d
] 
[move Lock into Repository, merge IO into Repository.ApplyPatches
Guillaume Hoffmann <guillaumh@gmail.com>**20120529135246
 Ignore-this: f69dd7071baa3683c6e0a9c8be95f461
] 
[move pending-patch-writing writePatch to Darcs.Repository.LowLevel
Guillaume Hoffmann <guillaumh@gmail.com>**20120529010714
 Ignore-this: fb3e7e9e6e9fc291ebddc7caacfd97ed
] 
[move malicious path test functions from Darcs.CommandAux to Darcs.Path
Guillaume Hoffmann <guillaumh@gmail.com>**20120529001546
 Ignore-this: ccab70026a9c35ea0a109f5ede842110
] 
[rm Darcs.Patch.MatchData making patterns simply String, style Arguments
Guillaume Hoffmann <guillaumh@gmail.com>**20120528215244
 Ignore-this: f61f71e3507cd500d5e7ced5584b624b
] 
[move function showFriendly from Darcs.Arguments to Darcs.PrintPatch
Guillaume Hoffmann <guillaumh@gmail.com>**20120528195655
 Ignore-this: 5420c0b294c3be89b146642ba1a7b7ea
] 
[make that no repository-related modules depend on Darcs.Arguments
Guillaume Hoffmann <guillaumh@gmail.com>**20120528190706
 Ignore-this: 20060cf5f82201b954cb0b79b5cab5cc
] 
[introduce Darcs.Path to centralize path handling
Guillaume Hoffmann <guillaumh@gmail.com>**20120527004157
 Ignore-this: 30f53dd9260e451236069082cc428d35
 
 Replaces Darcs.Patch.FileName and Darcs.RepoPath
] 
[move command-helping functions from Darcs.Arguments to Darcs.Commands
Guillaume Hoffmann <guillaumh@gmail.com>**20120526224013
 Ignore-this: 7b8c01a69d5fbc9af96cd428628f8d81
] 
[tests for issues 1845 1266 1932 2066 now passing
Guillaume Hoffmann <guillaumh@gmail.com>**20120520203141
 Ignore-this: ac9b60650a9fb49bb92625778b0a942d
] 
[resolve issue2198 move repo testing code to Darcs.Repository.Test
Guillaume Hoffmann <guillaumh@gmail.com>**20120526210746
 Ignore-this: 738571e479b21df16e12b48cec046fd9
 
 also move (versioned and unversioned) file listing functions from
 Darcs.Arguments to Darcs.Repository to avoid circular dependencies.
] 
[resolve issue2193 make that finalizeTentativeChanges no longer run tests
Guillaume Hoffmann <guillaumh@gmail.com>**20120526205635
 Ignore-this: 9d9de70af076f49441f92d9976037f48
] 
[Adapt to tar 0.4.0.0 API changes
matt@mattcox.ca**20120518155234
 Ignore-this: ac3315484e1bf9885538a0c2f8c05978
] 
[Accept issue1959 unwritable cache should not kill darcs
Owen Stephens <darcs@owenstephens.co.uk>**20120516172405
 Ignore-this: a4a06b65d93c80157ad988fa4aac5062
] 
[Improve issue2193 test style.
Eric Kow <kowey@darcs.net>**20120526071013
 Ignore-this: d033e147235cdda4262ab4222a3343f8
 
 * lib already does set -e
 * separate commands to make it easier to untangle failure
   (what went wrong?)
] 
[Improve issue2187 test style.
Eric Kow <kowey@darcs.net>**20120526065942
 Ignore-this: 14020b470896127cde12b35d6a751ec6
 
 * /bin/false does not exist on Mac
 * set -o pipefail already done by lib
 * set -e already done by lib (exit 1)
 * not can be useful here
 
 The above 3 sacrifice some portability (outside of the darcs test
 infrastructure) for hopefully a bit more clarity.
] 
[Fix show-authors test on OS X
Michael Hendricks <michael@ndrix.org>**20120518185240
 Ignore-this: 30f0fcca06fcc7153e27757b1cfb510b
 
 The pattern matches didn't work with grep or egrep, so I replaced
 them with explicit tab characters.
] 
[Accept issue2179 darcs diff no longer works given a dir path
Owen Stephens <darcs@owenstephens.co.uk>**20120413102019
 Ignore-this: dac40814a7613f9f15d89e254f1d6299
] 
[haddock for fixUrl and fix 2 haddocks
Guillaume Hoffmann <guillaumh@gmail.com>**20120524230619
 Ignore-this: b592011ebc53deb8c11c891a489193
] 
[kill footnotes in manual and uninformative command-overview paragraph
Guillaume Hoffmann <guillaumh@gmail.com>**20120520152828
 Ignore-this: f46a211392cd2d25a35c3d5f7f8978ee
] 
[remove inventory code of optimize without --reorder flag since it did nothing
Guillaume Hoffmann <guillaumh@gmail.com>**20120518213519
 Ignore-this: f0a0bb240d6e4ce8d8eeec02a27ae2e9
] 
[Tidy/Style ShowAuthors
Owen Stephens <darcs@owenstephens.co.uk>**20120516005525
 Ignore-this: e68e1b2f0fa94659ba741541448d52d6
] 
[Add missing -f flag to rm in show-authors test
Owen Stephens <darcs@owenstephens.co.uk>**20120516005033
 Ignore-this: 205ef029968dc6722ca50df9fce62b42
] 
[Add rank to show authors
Owen Stephens <darcs@owenstephens.co.uk>**20120516002046
 Ignore-this: 612ca611b794c19e4fca3adccb46cf18
] 
[resolve conflicts in cabal version field
Ganesh Sittampalam <ganesh@earth.li>**20120515061625
 Ignore-this: fdfe6c5dae8aff5a126cb838d95132e8
] 
[bump version to 2.8.1 and update NEWS
Ganesh Sittampalam <ganesh@earth.li>**20120514063206
 Ignore-this: 3447be4b2df1d59f22ec8f5920702647
] 
[resolve conflict in mtl dependency bump
Ganesh Sittampalam <ganesh@earth.li>**20120515061434
 Ignore-this: 74fd4dca32636bd26a9b264a1f4ccf0
] 
[bump mtl dependency
Ganesh Sittampalam <ganesh@earth.li>**20120514051154
 Ignore-this: 3eb10abb9aeded1fbd180ddeda2fef95
] 
[bump version to 2.8.0
Florent Becker <florent.becker@ens-lyon.org>**20120422150605
 Ignore-this: be7cfa545d0476865639d14fe97531fe
] 
[Bump version to 2.7.99.2
Ganesh Sittampalam <ganesh@earth.li>**20120407193656
 Ignore-this: e6b29a3a99143571340bb3f5eebfc592
] 
[Change version to 2.7.99.1
Florent Becker <florent.becker@ens-lyon.org>**20120330140653
 Ignore-this: 3c3fb6fec764391bc46b14c9e640bad9
] 
[darcs-users -> darcs-devel
Ganesh Sittampalam <ganesh@earth.li>**20120514062511
 Ignore-this: f43b88bd0edd6e716b848c1c267bedc3
] 
[update NEWS with 2.8 release notes
Ganesh Sittampalam <ganesh@earth.li>**20120411220320
 Ignore-this: 910347c64b7e4afb20c4f122f9a7ee95
] 
[home page: 2.8.1 release, trim news
Simon Michael <simon@joyful.com>**20120514182026
 Ignore-this: 32da6525b4b45affacaac36996174f8d
] 
[TAG 2.9.2
Guillaume Hoffmann <guillaumh@gmail.com>**20120514180916
 Ignore-this: 38bf5b10c3c719058147478be067de3e
] 
Patch bundle hash:
519745709f60e4ad5f78b2056c07581dc9b4ed02
msg15890 (view) Author: owst Date: 2012-07-20.10:38:03
This looks good, thanks! 

As a note, it looks like you manually attached the patch text somehow?
It's easier if you just `darcs send`, since darcs will use attachments,
making it easier to apply the patch and test it.
History
Date User Action Args
2012-07-16 05:19:23lukeworthcreate
2012-07-20 10:38:04owstsetstatus: needs-screening -> accepted
messages: + msg15890