text: I have text files created by a 3rd party tool that I'd like to keep in bzr. When two guys work on this file, I expect bzr will auto-merge the two files and the 3rd party tool will not function anymore. I can identify these files by some extension (e.g *.3rd)
  Is there some way to tell bzr to handle "*.3rd" files like it handles images? Essentially, no merging will take place. I assume the version that was checked in last will be kept.
  Question information
  - Language:
  - English Edit question
  - Status:
  - Solved
  - For:
  - Bazaar Edit question
  - Assignee:
  - No assignee Edit question
  - Solved by:
  - Andrew Bennetts
  - Solved:
  - 2010-03-05
  - Last query:
  - 2010-03-05
  - Last reply:
  - 2010-03-05
  https:/
  Thanks Andrew Bennetts, that solved my question.
  > Is there some way to tell bzr to handle "*.3rd" files like it handles images?
  To make bzr handle these files the way it would handle images or other binaries is easy to do with a simple plugin:
  ---- merge_3rd.py ----
  """Custom 'merge' logic for *.3rd files.
  Always conflicts if both branches have changed the file.
  """
  from bzrlib.merge import AbstractPerFile
  Merger, Merger
  def merge_3rd_
  files_hook( merger) : merger)
  """Hook to merge *.3rd files"""
  return Merge3rdFiles(
  class Merge3rdFiles(
  AbstractPerFile Merger) :
  def filename_
  matches( self, params): this_tree. inventory params. file_id] .name endswith( '.3rd') :
  inventory = self.merger.
  filename = inventory[
  if filename.
  return filename
  def merge_contents(
  self, params):
  params. winner == 'other' or is_file_ merge() or matches( params) ):
  """Merge the contents of a single file."""
  # First, check whether this custom merge logic should be used. We
  # expect most files should not be merged by this handler.
  if (
  # OTHER is a straight winner, rely on default merge.
  # THIS and OTHER aren't both files.
  not params.
  # The filename doesn't match *.3rd
  not self.filename_
  return 'not_applicable', None
  return 'conflicted', params.this_lines
  Merger.
  hooks.install_ named_hook( file_content' , merge_3rd_ files_hook, '*.3rd file merge')
  'merge_
  ---- END ----
  Put that file in ~/.bazaar/plugins or your system-wide bzrlib/plugins directory.
  This requires bzr 2.1 or newer.