~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/conflicts.py

  • Committer: Samuel Bronson
  • Date: 2012-08-30 20:36:18 UTC
  • mto: (6015.57.3 2.4)
  • mto: This revision was merged to the branch mainline in revision 6558.
  • Revision ID: naesten@gmail.com-20120830203618-y2dzw91nqpvpgxvx
Update INSTALL for switch to Python 2.6 and up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# TODO: 'bzr resolve' should accept a directory name and work from that
18
18
# point down
19
19
 
20
 
from __future__ import absolute_import
21
 
 
22
20
import os
23
21
 
24
22
from bzrlib.lazy_import import lazy_import
34
32
    transform,
35
33
    workingtree,
36
34
    )
37
 
from bzrlib.i18n import gettext, ngettext
38
35
""")
39
36
from bzrlib import (
40
37
    commands,
52
49
    Merge will do its best to combine the changes in two branches, but there
53
50
    are some kinds of problems only a human can fix.  When it encounters those,
54
51
    it will mark a conflict.  A conflict means that you need to fix something,
55
 
    before you can commit.
 
52
    before you should commit.
56
53
 
57
54
    Conflicts normally are listed as short, human-readable messages.  If --text
58
55
    is supplied, the pathnames of files with text conflicts are listed,
82
79
 
83
80
 
84
81
resolve_action_registry.register(
85
 
    'done', 'done', 'Marks the conflict as resolved.')
 
82
    'done', 'done', 'Marks the conflict as resolved' )
86
83
resolve_action_registry.register(
87
84
    'take-this', 'take_this',
88
 
    'Resolve the conflict preserving the version in the working tree.')
 
85
    'Resolve the conflict preserving the version in the working tree' )
89
86
resolve_action_registry.register(
90
87
    'take-other', 'take_other',
91
 
    'Resolve the conflict taking the merged version into account.')
 
88
    'Resolve the conflict taking the merged version into account' )
92
89
resolve_action_registry.default_key = 'done'
93
90
 
94
91
class ResolveActionOption(option.RegistryOption):
106
103
    Merge will do its best to combine the changes in two branches, but there
107
104
    are some kinds of problems only a human can fix.  When it encounters those,
108
105
    it will mark a conflict.  A conflict means that you need to fix something,
109
 
    before you can commit.
 
106
    before you should commit.
110
107
 
111
108
    Once you have fixed a problem, use "bzr resolve" to automatically mark
112
109
    text conflicts as fixed, "bzr resolve FILE" to mark a specific conflict as
123
120
    def run(self, file_list=None, all=False, action=None, directory=None):
124
121
        if all:
125
122
            if file_list:
126
 
                raise errors.BzrCommandError(gettext("If --all is specified,"
127
 
                                             " no FILE may be provided"))
 
123
                raise errors.BzrCommandError("If --all is specified,"
 
124
                                             " no FILE may be provided")
128
125
            if directory is None:
129
126
                directory = u'.'
130
127
            tree = workingtree.WorkingTree.open_containing(directory)[0]
148
145
            if file_list is None:
149
146
                un_resolved, resolved = tree.auto_resolve()
150
147
                if len(un_resolved) > 0:
151
 
                    trace.note(ngettext('%d conflict auto-resolved.',
152
 
                        '%d conflicts auto-resolved.', len(resolved)),
153
 
                        len(resolved))
154
 
                    trace.note(gettext('Remaining conflicts:'))
 
148
                    trace.note('%d conflict(s) auto-resolved.', len(resolved))
 
149
                    trace.note('Remaining conflicts:')
155
150
                    for conflict in un_resolved:
156
151
                        trace.note(unicode(conflict))
157
152
                    return 1
158
153
                else:
159
 
                    trace.note(gettext('All conflicts resolved.'))
 
154
                    trace.note('All conflicts resolved.')
160
155
                    return 0
161
156
            else:
162
157
                # FIXME: This can never occur but the block above needs some
165
160
                pass
166
161
        else:
167
162
            before, after = resolve(tree, file_list, action=action)
168
 
            trace.note(ngettext('{0} conflict resolved, {1} remaining',
169
 
                                '{0} conflicts resolved, {1} remaining',
170
 
                                before-after).format(before - after, after))
 
163
            trace.note('%d conflict(s) resolved, %d remaining'
 
164
                       % (before - after, after))
171
165
 
172
166
 
173
167
def resolve(tree, paths=None, ignore_misses=False, recursive=False,