~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/conflicts.py

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
# TODO: Move this into builtins
18
18
 
19
 
# TODO: 'bzr resolve' should accept a directory name and work from that 
 
19
# TODO: 'bzr resolve' should accept a directory name and work from that
20
20
# point down
21
21
 
22
22
import os
228
228
        """Generator of stanzas"""
229
229
        for conflict in self:
230
230
            yield conflict.as_stanza()
231
 
            
 
231
 
232
232
    def to_strings(self):
233
233
        """Generate strings for the provided conflicts"""
234
234
        for conflict in self:
249
249
    def select_conflicts(self, tree, paths, ignore_misses=False,
250
250
                         recurse=False):
251
251
        """Select the conflicts associated with paths in a tree.
252
 
        
 
252
 
253
253
        File-ids are also used for this.
254
254
        :return: a pair of ConflictLists: (not_selected, selected)
255
255
        """
299
299
                    print "%s is not conflicted" % path
300
300
        return new_conflicts, selected_conflicts
301
301
 
302
 
 
 
302
 
303
303
class Conflict(object):
304
304
    """Base class for all types of conflict"""
305
305
 
403
403
    """
404
404
 
405
405
    rformat = "%(class)s(%(action)r, %(path)r, %(file_id)r)"
406
 
    
 
406
 
407
407
    def __init__(self, action, path, file_id=None):
408
408
        Conflict.__init__(self, path, file_id)
409
409
        self.action = action
428
428
    def __init__(self, action, path, conflict_path, file_id=None,
429
429
                 conflict_file_id=None):
430
430
        HandledConflict.__init__(self, action, path, file_id)
431
 
        self.conflict_path = conflict_path 
 
431
        self.conflict_path = conflict_path
432
432
        # warn turned off, because the factory blindly transfers the Stanza
433
433
        # values to __init__.
434
434
        self.conflict_file_id = osutils.safe_file_id(conflict_file_id,
435
435
                                                     warn=False)
436
 
        
 
436
 
437
437
    def _cmp_list(self):
438
 
        return HandledConflict._cmp_list(self) + [self.conflict_path, 
 
438
        return HandledConflict._cmp_list(self) + [self.conflict_path,
439
439
                                                  self.conflict_file_id]
440
440
 
441
441
    def as_stanza(self):
443
443
        s.add('conflict_path', self.conflict_path)
444
444
        if self.conflict_file_id is not None:
445
445
            s.add('conflict_file_id', self.conflict_file_id.decode('utf8'))
446
 
            
 
446
 
447
447
        return s
448
448
 
449
449