Commit Graph

54 Commits

Author SHA1 Message Date
Adrian Buehlmann
4163cf2e6f rename util.find_exe to findexe 2011-05-08 20:35:46 +02:00
Adrian Buehlmann
554b565228 rename util.lookup_reg to lookupreg 2011-05-06 15:16:22 +02:00
Dan Villiom Podlaski Christiansen
511c941422 prevent transient leaks of file handle by using new helper functions
These leaks may occur in environments that don't employ a reference
counting GC, i.e. PyPy.

This implies:
 - changing opener(...).read() calls to opener.read(...)
 - changing opener(...).write() calls to opener.write(...)
 - changing open(...).read(...) to util.readfile(...)
 - changing open(...).write(...) to util.writefile(...)
2011-05-02 10:11:18 +02:00
Steve Borho
fe1b6543d5 filemerge: introduce a 'regkeyalt' merge tool variable
This allows us to provide alternate search keys for 64bit operating systems that
may have 32bit merge tools installed.  Presumably it may find other uses.
2011-03-08 13:05:18 -06:00
Steve Borho
a3baf6a2e7 merge: implement --tool arguments using new ui.forcemerge configurable
ui.forcemerge is set before calling into merge or resolve commands, then unset
to prevent ui pollution for further operations.

ui.forcemerge takes precedence over HGMERGE, but mimics HGMERGE behavior if the
given --tool is not found by the merge-tools machinery.  This makes it possible
to do:  hg resolve --tool="python mymerge.py" FILE

With this approach, HGMERGE and ui.merge are not harmed by --tool
2010-10-19 22:33:52 -05:00
Thomas Arendsen Hein
d83b895da6 Fix merge-tools.checkconflicts
re.match only looks at the beginning of the merged file, and without
re.MULTILINE the file had to end with ">>>>>>> something".

Now conflict markers inside the file are found, too.
2010-08-26 17:38:43 +02:00
Matt Mackall
5fd0f613e6 merge with stable 2010-08-21 10:48:49 -05:00
Matt Mackall
395274c87f merge: move reverse-merge logic out of filemerge (issue2342) 2010-08-21 10:41:29 -05:00
Steve Losh
b2ecd09159 util: add an interpolate() function to for replacing multiple values
util.interpolate can be used to replace multiple items in a string all at once
(and optionally apply a function to the replacement), without worrying about
recursing:

    >>> import util
    >>> s = '$foo, $spam'
    >>> util.interpolate(r'\$', { 'foo': 'bar', 'spam': 'eggs' }, s)
    'bar, eggs'
    >>> util.interpolate(r'\$', { 'foo': 'spam', 'spam': 'foo' }, s)
    'spam, foo'
    >>> util.interpolate(r'\$', { 'foo': 'spam', 'spam': 'foo' }, s, lambda s: s.upper())
    'SPAM, FOO'

The patch also changes filemerge.py to use this new function.
2010-08-18 18:18:26 -04:00
Nicolas Dumazet
064d677bd7 filectx: use cmp(self, fctx) instead of cmp(self, text)
This allows more flexibility in implementation, and in particular,
lets the context decide if revision text has to be loaded or not.
2010-07-27 23:40:46 +09:00
David Champion
b8cccccefd merge: tool.check = prompt will force an interactive merge check
tool.check = prompt can be used when the exit status of a merge
tool is unreliable but an explicit user signoff on the merge result is
acceptable.
2010-05-10 11:04:56 -05:00
David Champion
884303ae82 merge: introduce tool.check parameter
tool.check is a list of check options, and can be used in place of
tool.checkchanged and tool.checkconflicts:

Equivalences:
tool.checkchanged = yes
tool.checkconflicts = no
tool.check = changed

tool.checkchanged = no
tool.checkconflicts = yes
tool.check = conflicts

tool.checkchanged = yes
tool.checkconflicts = yes
tool.check = changed, conflicts

Add _toollist() wrapper for ui.configlist() to implement this consistently.

checkchanged and checkconflicts are still supported, but check is
preferred for implementing new check options.
2010-05-10 11:04:56 -05:00
David Champion
14b32f640c merge: tool.premerge=keep will leave premerge markers in $local 2010-04-21 11:57:45 -05:00
Benoit Boissinot
7137f04bb0 filemerge: use working dir parent as ancestor for backward wdir merge
I checked the tests, they were bogus in the first place
2010-04-19 20:41:53 +02:00
Patrick Mezard
c5a46629ec filemerge: use native path separators when merging (issue1399) 2010-02-23 23:19:09 +01:00
Benoit Boissinot
4371f512b2 fix spaces/identation issues 2010-02-05 18:50:08 +01:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Sune Foldager
d9c1a3a0ca merge: supply base node to merge tools in the environment
Merge tools will be able to exploit this to correctly merge backouts.
This won't work fully, though, until issue 1327 is solved, since the
node information is not necessarily correct.
2009-11-04 15:18:19 +01:00
Martin Geisler
9f1896c083 do not attempt to translate ui.debug output 2009-09-19 01:15:38 +02:00
Martin Geisler
ecfc8a98d6 filemerge, subrepo: correct indention 2009-07-07 17:26:20 +02:00
Simon Heimberg
e0e4fc74e3 ui: extract choice from prompt
avoid translating single characters (as l for _local or sym_link)
2009-06-21 01:13:19 +02:00
Matt Mackall
7849adbee8 filemerge: fix internal:dump 2009-06-20 16:42:51 -05:00
Matt Mackall
fed8f4af82 filemerge: add internal:dump
This create foo.{local,other,base} files for people to manually merge
files while littering their working directory.
2009-06-18 16:56:03 -05:00
Matt Mackall
48da4c1c20 filemerge: add internal:prompt target 2009-06-18 16:56:02 -05:00
Martin Geisler
d6db5e0057 use ui instead of repo.ui when the former is in scope 2009-05-24 22:37:20 +02:00
Matt Mackall
89c18ad8ce match: add some default args 2009-05-24 02:56:14 -05:00
Matt Mackall
532c58d931 match: change all users of util.matcher to match.match 2009-05-24 02:56:14 -05:00
Simon Heimberg
09ac1e6c92 separate import lines from mercurial and general python modules 2009-04-28 17:40:46 +02:00
Steve Borho
83629eeaea simplemerge: use ui.warn() for warnings 2009-04-30 23:57:36 -05:00
Steve Borho
52bf113f2e ui: replace regexp pattern with sequence of choices
Use ampersands (&) to delineate the response char in each choice.
ui.prompt() responses are now explicitly case insensitive.  GUIs
that subclass ui can generate dialogs from the full choice names.
2009-04-30 10:15:32 -05:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Matt Mackall
2f9b02c62d replace util.sort with sorted built-in
This is marginally faster for small and moderately-sized lists
2009-04-26 16:50:44 -05:00
Peter Arrenbrecht
bc21361ed2 cleanup: drop unused imports 2009-03-23 13:12:07 +01:00
Mads Kiilerich
acb5117176 More verbose logging when filemerge searches for merge-tool
Previously it was very hard to find out what was going on when the expected
merge tool wasn't used. This patch tries to improve that.

hg merge -v now shows which tools were searched for but not found.
2008-11-07 02:47:12 +01:00
Matt Mackall
a65ef7bc5d util: add sort helper 2008-06-27 18:28:45 -05:00
Matt Mackall
25b1f97147 context: remove islink and isexec methods 2008-06-26 13:52:16 -05:00
Matt Mackall
d462e1fc26 simplify flag handling
add _checklink var to dirstate
introduce dirstate.flagfunc
switch users of util.execfunc/linkfunc to flagfunc
change manifestdict.set to take a flags string
change ctx.fileflags to ctx.flags
change gitmode func to a dict
remove util.execfunc/linkfunc
2008-06-26 13:46:34 -05:00
Matt Mackall
619e79c725 Merge with -stable 2008-04-13 11:31:45 -05:00
Matt Mackall
8d82cba09a merge: introduce mergestate 2008-04-10 15:02:24 -05:00
Dov Feldstern
b457436bd5 use internal merge tool when specified for a merge-pattern in hgrc
It is possible to specify in the hgrc file that one of the internal merge
tools (internal:fail, internal:local or internal:other) be used for
performing merges on files matching a given pattern. However, this setting
is not being acted upon (the merge tool is not found). This patch fixes that.
2008-04-04 02:21:53 +03:00
Joel Rosdahl
4f8012378a Remove unused imports 2008-03-06 22:23:41 +01:00
Joel Rosdahl
5dae3059a0 Expand import * to allow Pyflakes to find problems 2008-03-06 22:23:26 +01:00
Steve Borho
c9911f3bdf filemerge: more backwards compatible behavior for ui.merge
if ui.merge matches a tool in [merge-tools], it is used as the
default tool selection but may be rejected by binary or gui or
other checks.  If ui.merge does not match a merge tool, it is
used unconditionally.
2008-02-06 20:44:25 -06:00
Steve Borho
a42f97b40e filemerge: add 'checkchanged' merge tool property 2008-02-06 20:32:06 -06:00
Steve Borho
eda1ae23fa filemerge: wrap quotes around tool path 2008-02-04 19:38:34 -06:00
dhruva
3ad3c6c3ba filemerge: fix pattern matching 2008-02-04 09:56:01 -06:00
Lee Cantey
abeb7dc0ee filemerge: fix path to working file when fixeol is enabled 2008-02-03 23:58:02 -08:00
Matt Mackall
5d1d504393 filemerge: handle missing regappend 2008-02-04 09:51:56 -06:00
Matt Mackall
ad1e6058b9 filemerge: add config item for GUI tools
<tool>.gui indicates whether a tool requires a GUI to run
2008-02-03 19:29:05 -06:00