~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/conflicts.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-11-05 08:35:39 UTC
  • mfrom: (5521.1.2 670851-directory-and-files)
  • Revision ID: pqm@pqm.ubuntu.com-20101105083539-urkk2to9qakthagn
(vila) Respect --directory when path parameters are also used for shelve and
 restore (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
# point down
19
19
 
20
20
import os
21
 
import re
22
21
 
23
22
from bzrlib.lazy_import import lazy_import
24
23
lazy_import(globals(), """
25
24
import errno
26
25
 
27
26
from bzrlib import (
28
 
    builtins,
29
27
    cleanup,
30
28
    commands,
31
29
    errors,
46
44
 
47
45
 
48
46
class cmd_conflicts(commands.Command):
49
 
    """List files with conflicts.
 
47
    __doc__ = """List files with conflicts.
50
48
 
51
49
    Merge will do its best to combine the changes in two branches, but there
52
50
    are some kinds of problems only a human can fix.  When it encounters those,
60
58
    Use bzr resolve when you have fixed a problem.
61
59
    """
62
60
    takes_options = [
 
61
            'directory',
63
62
            option.Option('text',
64
63
                          help='List paths of files with text conflicts.'),
65
64
        ]
66
65
    _see_also = ['resolve', 'conflict-types']
67
66
 
68
 
    def run(self, text=False):
69
 
        wt = workingtree.WorkingTree.open_containing(u'.')[0]
 
67
    def run(self, text=False, directory=u'.'):
 
68
        wt = workingtree.WorkingTree.open_containing(directory)[0]
70
69
        for conflict in wt.conflicts():
71
70
            if text:
72
71
                if conflict.typestring != 'text conflict':
99
98
 
100
99
 
101
100
class cmd_resolve(commands.Command):
102
 
    """Mark a conflict as resolved.
 
101
    __doc__ = """Mark a conflict as resolved.
103
102
 
104
103
    Merge will do its best to combine the changes in two branches, but there
105
104
    are some kinds of problems only a human can fix.  When it encounters those,
113
112
    aliases = ['resolved']
114
113
    takes_args = ['file*']
115
114
    takes_options = [
 
115
            'directory',
116
116
            option.Option('all', help='Resolve all conflicts in this tree.'),
117
117
            ResolveActionOption(),
118
118
            ]
119
119
    _see_also = ['conflicts']
120
 
    def run(self, file_list=None, all=False, action=None):
 
120
    def run(self, file_list=None, all=False, action=None, directory=None):
121
121
        if all:
122
122
            if file_list:
123
123
                raise errors.BzrCommandError("If --all is specified,"
124
124
                                             " no FILE may be provided")
125
 
            tree = workingtree.WorkingTree.open_containing('.')[0]
 
125
            if directory is None:
 
126
                directory = u'.'
 
127
            tree = workingtree.WorkingTree.open_containing(directory)[0]
126
128
            if action is None:
127
129
                action = 'done'
128
130
        else:
129
 
            tree, file_list = builtins.tree_files(file_list)
 
131
            tree, file_list = workingtree.WorkingTree.open_containing_paths(
 
132
                file_list, directory)
130
133
            if file_list is None:
131
134
                if action is None:
132
135
                    # FIXME: There is a special case here related to the option