~brz/brz-debian/byoci

« back to all changes in this revision

Viewing changes to util.py

  • Committer: James Westby
  • Date: 2007-05-03 18:42:47 UTC
  • mfrom: (95.1.14 bzr-builddeb.0.15.tests)
  • Revision ID: jw+debian@jameswestby.net-20070503184247-3si8cp52q0soyy0f
* Lock the working trees to fix compatibility with 0.15+ dirstate trees.
  (Closes: #421900)
* Add the start of a test suite to help avoid bugs like that.

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
def find_changelog(t, merge):
99
99
    changelog_file = 'debian/changelog'
100
100
    larstiq = False
101
 
    if not t.has_filename(changelog_file):
102
 
      if merge:
103
 
        #Assume LartstiQ's layout (.bzr in debian/)
104
 
        changelog_file = 'changelog'
105
 
        larstiq = True
106
 
        if not t.has_filename(changelog_file):
107
 
          raise DebianError("Could not open debian/changelog or changelog")
108
 
      else:
109
 
        raise DebianError("Could not open debian/changelog")
110
 
    mutter("Using '%s' to get package information", changelog_file)
111
 
    changelog_id = t.inventory.path2id(changelog_file)
112
 
    contents = t.get_file_text(changelog_id)
 
101
    t.lock_read()
 
102
    try:
 
103
      if not t.has_filename(changelog_file):
 
104
        if merge:
 
105
          #Assume LartstiQ's layout (.bzr in debian/)
 
106
          changelog_file = 'changelog'
 
107
          larstiq = True
 
108
          if not t.has_filename(changelog_file):
 
109
            raise DebianError("Could not open debian/changelog or changelog")
 
110
        else:
 
111
          raise DebianError("Could not open debian/changelog")
 
112
      mutter("Using '%s' to get package information", changelog_file)
 
113
      changelog_id = t.inventory.path2id(changelog_file)
 
114
      contents = t.get_file_text(changelog_id)
 
115
    finally:
 
116
      t.unlock()
113
117
    changelog = Changelog(contents)
114
118
    return changelog, larstiq 
115
119