Commit Graph

70 Commits

Author SHA1 Message Date
Augie Fackler
b6015ab3da filemerge: move from dict() construction to {} literals
The latter are both faster and more consistent across Python 2 and 3.
2014-03-12 13:15:09 -04:00
Matt Mackall
13d2a13ea6 ui: merge prompt text components into a singe string
This will help avoid problems with partial or mismatched translation
of the components.
2013-05-22 17:31:43 -05:00
Mads Kiilerich
4d69012587 merge: warn when internal:merge cannot merge symlinks
A follow-up to 6847621b4da6.

internal:merge should never be picked for merging symlinks ... but in the test
suite we have HGMERGE="internal:merge" which bypasses all the usual merge-tool
cleverness. Without any output it can be hard to figure out what happened and
where the problem is.
2013-01-15 01:05:11 +01:00
Mads Kiilerich
e379b091a9 merge: never do premerge on symlinks
Simplemerge is not symlink aware and will never do the right thing on symlinks.
2013-01-08 04:15:46 +01:00
Mads Kiilerich
b67259b61a merge: make internal merge fail cleanly on symlinks
Simplemerge is not symlink aware and will never do the the right thing on
symlinks. It would read the symlink as a file and abort with 'No such file or
directory' on dangling symlinks.

Instead, internal:merge now simply fails to merge symlinks.
2013-01-08 04:15:41 +01:00
Keegan Carruthers-Smith
556604a6f0 filemerge: use util.shellquote when calling merge (issue3581) 2012-10-26 12:02:58 -07:00
Matt Mackall
2a84e7e364 merge with stable 2012-03-13 16:29:13 -05:00
Matt Mackall
2fd77dbcdb filemerge: restore default prompt for binary/symlink lost in c5dd8ad52586
This could result in a traceback.
2012-03-13 15:12:26 -05:00
Thomas Arendsen Hein
d564ac8a84 filemerge: remove temporary files when using internal:dump as merge-tool 2012-03-01 17:35:12 +01:00
Matt Mackall
6287da213f filemerge: remove some redundancy in decorators/docstrings 2012-02-16 15:58:51 -06:00
FUJIWARA Katsunori
4629df01c9 filemerge: create detail of internal merge tools from documentation string
this patch introduces 'internaltoolsmarker' which creates detail of
each internal merge tools from documentation string for 'hg help merge-tools'.
2012-02-12 21:38:12 +09:00
FUJIWARA Katsunori
030b0e3bf3 filemerge: refactoring of 'filemerge()'
current 'filemerge.filemerge()' implementation is verfy complicated.

    - it is not easy to add new internal merge tools
      (only by patching on 'filemerge()', or replacing it completely)

    - cleanup of temporary files is unsatisfactory
      ('internal:dump' does not, in fact)

this is patch for refactoring of 'filemerge()' to isolate each
internal merge tool implementations from 'filemerge()', and clean up
common part in it.
2012-02-12 21:38:12 +09:00
Laurens Holst
8daae4999d context: add isbinary function 2011-12-21 18:20:15 +01:00
Matt Mackall
66de5cde16 merge: give a special message for internal:merge failure (issue3105) 2011-11-16 18:04:19 -06:00
Greg Ward
aeec456986 merge: expand environment variables and ~/ in tool.executable
hgrc(5) already implies that this works, so we might as well support it.

Another approach would be to implement this in util.findexe(): that
would benefit other callers of findexe(), e.g. convert and anyone
calling the user's editor. But findexe() is really implemented in
both posix.py and windows.py, so this would make both of those modules
depend on util.py: not good. So keep it narrow and only for merge
tools.
2011-10-12 21:45:58 -04:00
Idan Kamara
446fde5f1b filemerge: use ui out descriptor when calling util.system 2011-06-24 17:04:37 +03:00
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