/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/_patiencediff_py.py

  • Committer: Martin Pool
  • Date: 2007-10-03 08:06:44 UTC
  • mto: This revision was merged to the branch mainline in revision 2901.
  • Revision ID: mbp@sourcefrog.net-20071003080644-oivy0gkg98sex0ed
Avoid internal error tracebacks on failure to lock on readonly transport (#129701).

Add new LockFailed, which doesn't imply that we failed to get it because of
contention.  Raise this if we fail to create the pending or lock directories
because of Transport errors.

UnlockableTransport is not an internal error.

ReadOnlyLockError has a message which didn't match its name or usage; it's now
deprecated and callers are updated to use LockFailed which is more appropriate.

Add zero_ninetytwo deprecation symbol.

Unify assertMatchesRe with TestCase.assertContainsRe.

When the constructor is deprecated, just say that the class is deprecated, not
the __init__ method - this works better with applyDeprecated in tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
18
18
 
19
19
from bisect import bisect
49
49
        else:
50
50
            index[line]= i
51
51
    # make btoa[i] = position of line i in a, unless
52
 
    # that line doesn't occur exactly once in both,
 
52
    # that line doesn't occur exactly once in both, 
53
53
    # in which case it's set to None
54
54
    btoa = [None] * len(b)
55
55
    index2 = {}
79
79
            k = len(stacks)
80
80
        # as an optimization, check if the next line comes right after
81
81
        # the previous line, because usually it does
82
 
        elif stacks and stacks[k] < apos and (k == len(stacks) - 1 or
 
82
        elif stacks and stacks[k] < apos and (k == len(stacks) - 1 or 
83
83
                                              stacks[k+1] > apos):
84
84
            k += 1
85
85
        else:
176
176
    length = 0
177
177
    for i_a, i_b in matches:
178
178
        if (start_a is not None
179
 
            and (i_a == start_a + length)
 
179
            and (i_a == start_a + length) 
180
180
            and (i_b == start_b + length)):
181
181
            length += 1
182
182
        else:
196
196
    # For consistency sake, make sure all matches are only increasing
197
197
    next_a = -1
198
198
    next_b = -1
199
 
    for (a, b, match_len) in answer:
200
 
        if a < next_a:
201
 
            raise ValueError('Non increasing matches for a')
202
 
        if b < next_b:
203
 
            raise ValueError('Non increasing matches for b')
 
199
    for a,b,match_len in answer:
 
200
        assert a >= next_a, 'Non increasing matches for a'
 
201
        assert b >= next_b, 'Not increasing matches for b'
204
202
        next_a = a + match_len
205
203
        next_b = b + match_len
206
204
 
230
228
        >>> s.get_matching_blocks()
231
229
        [(0, 0, 2), (3, 2, 2), (5, 4, 0)]
232
230
        """
233
 
        # jam 20060525 This is the python 2.4.1 difflib get_matching_blocks
 
231
        # jam 20060525 This is the python 2.4.1 difflib get_matching_blocks 
234
232
        # implementation which uses __helper. 2.4.3 got rid of helper for
235
233
        # doing it inline with a queue.
236
234
        # We should consider doing the same for recurse_matches