Merge lp:~mandel/desktopcouch/fix_bug_519873 into lp:desktopcouch
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Chad Miller on 2010-02-26 | ||||
| Approved revision: | not available | ||||
| Merged at revision: | not available | ||||
| Proposed branch: | lp:~mandel/desktopcouch/fix_bug_519873 | ||||
| Merge into: | lp:desktopcouch | ||||
| Diff against target: |
142 lines (+105/-0) 2 files modified
desktopcouch/records/record.py (+43/-0) desktopcouch/records/tests/test_record.py (+62/-0) |
||||
| To merge this branch: | bzr merge lp:~mandel/desktopcouch/fix_bug_519873 | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| John O'Brien (community) | Approve on 2010-02-15 | ||
| Chad Miller (community) | 2010-02-10 | Approve on 2010-02-10 | |
|
Review via email:
|
|||
Commit Message
Make list-like MergableList objects behave more like lists by adding pop() and remove() methods. (LP: #519873)
| Manuel de la Peña (mandel) wrote : | # |
| Chad Miller (cmiller) wrote : | # |
"for index, current_value in enumerate(self):" is preferable to "index = 0", then "for current_value in..." and "index += 1" inside.
Also, I'm not too enthusiastic about restricting pop/remove on the last item. It's not a problem for lists to remove the last item. Perhaps we should destroy the container that must not be empty instead, when it reaches zero entries. Or, change the container so that it may be empty? (I do not understand the empty restriction yet.)
| Manuel de la Peña (mandel) wrote : | # |
The empty restriction is coming from the RecordData class that does not allow to add empty lists so we do not allow to add them and then delete all its contents. I know there is a bug files regarding this (https:/
| Eric Casteleijn (thisfred) wrote : | # |
I suggested a solution to https:/
| John O'Brien (jdobrien) wrote : | # |
The code looks good but I get unrelated errors.
=======
FAIL: test_get_
-------
Traceback (most recent call last):
File "/usr/lib/
result = f(*args, **kw)
File "/usr/lib/
result = f(*a, **kw)
File "/home/
self.
File "/usr/lib/
% (msg, pformat(first), pformat(second)))
FailTest: not equal:
a = ['a0624880-
b = ['5946ee98-
| Manuel de la Peña (mandel) wrote : | # |
Interesting, are you running Lucid? I ran the tests on Karmic and everything was find there.. Let me know so I pump my OS to try and find the error.
> The code looks good but I get unrelated errors.
>
>
> =======
> FAIL: test_get_
> -------
> Traceback (most recent call last):
> File "/usr/lib/
> in maybeDeferred
> result = f(*args, **kw)
> File "/usr/lib/
> in runWithWarnings
> result = f(*a, **kw)
> File "/home/
> h/pair/
> self.assertEqua
> File "/usr/lib/
> in failUnlessEqual
> % (msg, pformat(first), pformat(second)))
> FailTest: not equal:
> a = ['a0624880-
> b = ['5946ee98-
| Chad Miller (cmiller) wrote : | # |
Attempt to merge lp:~mandel/desktopcouch/fix_bug_519873 into lp:desktopcouch failed due to merge conflicts:
text conflict in bin/desktopcouc
| Chad Miller (cmiller) wrote : | # |
Attempt to merge lp:~mandel/desktopcouch/fix_bug_519873 into lp:desktopcouch failed due to merge conflicts:
text conflict in bin/desktopcouc
- 125. By Manuel de la Peña on 2010-02-25
-
Merged with current trunk
| Manuel de la Peña (mandel) wrote : | # |
The merge should be possible now. As a side note since I have been using Lucid I get the fails that John reported.
> Attempt to merge lp:~mandel/desktopcouch/fix_bug_519873 into lp:desktopcouch
> failed due to merge conflicts:
>
> text conflict in bin/desktopcouc
| Chad Miller (cmiller) wrote : | # |
Tarmac has no memory. When it marks a failed merge as Needs Review, it doesn't try again until someone marks the branch Approved again.

As explained in bug 519873 the remove and pop methods are missing. Although the optimal solution for this kind of problem would be implement a Bimap for the MergeableList this is not feseable because python lists and dicts are not hashable. This solution provides a O(n*m) performance where n is the number of objects in the mergeable list and m is the size of the possible inner lists.