Merge lp:~toshio/bzr-gtk/handle-dirty-patches into lp:bzr-gtk/gtk2

Proposed by Toshio Kuratomi on 2010-02-08
Status: Merged
Merge reported by: Jelmer Vernooij
Merged at revision: not available
Proposed branch: lp:~toshio/bzr-gtk/handle-dirty-patches
Merge into: lp:bzr-gtk/gtk2
Diff against target: 37 lines (+4/-3)
2 files modified
bzr-handle-patch (+1/-1)
diff.py (+3/-2)
To merge this branch: bzr merge lp:~toshio/bzr-gtk/handle-dirty-patches
Reviewer Review Type Date Requested Status
Bazaar GTK maintainers 2010-02-08 Pending
Review via email: mp+18856@code.launchpad.net
To post a comment you must log in.
Toshio Kuratomi (toshio) wrote :

Fix for traceback when applying a patch that has non-patch content. Need to have a fix applied to bzrlib before this is applied.

Jelmer Vernooij (jelmer) wrote :

We shouldn't pass allow_dirty to parse_patches() unless the version of bzr is recent enough.

Toshio Kuratomi (toshio) wrote :

Updated. I used inspect.getargspec() as it seems more pythonic to check that the function we're calling supports the argument. We could compare to bzrlib.version_info instead if you don't like inspect but the fix doesn't show up in bzrlib until 2.2b1.

Toshio Kuratomi (toshio) wrote :

"doesn't show up in bzrlib until 2.2b1."... so distributions that backport the fix to bzr-2.0.x or 2.1.x would need to patch this section of code disable the version check. Whereas using getargspec() will just work if the fix is backported.

Jelmer Vernooij (jelmer) wrote :

I can live with getargspec. I'll merge, sorry about the delay.

Jelmer Vernooij (jelmer) wrote :

Nevermind, it was already merged :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzr-handle-patch'
2--- bzr-handle-patch 2009-11-13 19:07:28 +0000
3+++ bzr-handle-patch 2010-04-13 14:23:27 +0000
4@@ -25,7 +25,7 @@
5 try:
6 directive = merge_directive.MergeDirective.from_lines(lines)
7 except errors.NotAMergeDirective:
8- controller = DiffController(path, lines)
9+ controller = DiffController(path, lines, allow_dirty=True)
10 else:
11 controller = MergeDirectiveController(path, directive)
12 window = controller.window
13
14=== modified file 'diff.py'
15--- diff.py 2010-02-24 07:47:17 +0000
16+++ diff.py 2010-04-13 14:23:27 +0000
17@@ -524,9 +524,10 @@
18
19 class DiffController(object):
20
21- def __init__(self, path, patch, window=None):
22+ def __init__(self, path, patch, window=None, allow_dirty=False):
23 self.path = path
24 self.patch = patch
25+ self.allow_dirty = allow_dirty
26 if window is None:
27 window = DiffWindow(operations=self._provide_operations())
28 self.initialize_window(window)
29@@ -538,7 +539,7 @@
30
31 def get_diff_sections(self):
32 yield "Complete Diff", None, ''.join(self.patch)
33- for patch in parse_patches(self.patch):
34+ for patch in parse_patches(self.patch, self.allow_dirty):
35 oldname = patch.oldname.split('\t')[0]
36 newname = patch.newname.split('\t')[0]
37 yield oldname, newname, str(patch)

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: