Merge lp:~jelmer/brz/quilt-more into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/quilt-more
Merge into: lp:brz
Diff against target: 115 lines (+53/-5)
3 files modified
breezy/plugins/quilt/quilt.py (+8/-2)
breezy/plugins/quilt/tests/test_wrapper.py (+17/-1)
breezy/plugins/quilt/wrapper.py (+28/-2)
To merge this branch: bzr merge lp:~jelmer/brz/quilt-more
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+371831@code.launchpad.net

Commit message

Add quilt_delete call.

Description of the change

Add quilt_delete call.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Thanks!

review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/plugins/quilt/quilt.py'
2--- breezy/plugins/quilt/quilt.py 2019-06-16 13:10:54 +0000
3+++ breezy/plugins/quilt/quilt.py 2019-08-31 10:25:49 +0000
4@@ -83,12 +83,18 @@
5 series_file=self.series_file, quiet=quiet, force=force,
6 refresh=refresh)
7
8- def push(self, patch, quiet=None):
9+ def push(self, patch, quiet=None, force=None, refresh=None):
10 return wrapper.quilt_push(
11 self.tree.basedir, patch, patches_dir=self.patches_dir,
12- series_file=self.series_file, quiet=quiet)
13+ series_file=self.series_file, quiet=quiet, force=force,
14+ refresh=refresh)
15
16 def pop(self, patch, quiet=None):
17 return wrapper.quilt_pop(
18 self.tree.basedir, patch, patches_dir=self.patches_dir,
19 series_file=self.series_file, quiet=quiet)
20+
21+ def delete(self, patch, remove=False):
22+ return wrapper.quilt_delete(
23+ self.tree.basedir, patch, patches_dir=self.patches_dir,
24+ series_file=self.series_file, remove=remove)
25
26=== modified file 'breezy/plugins/quilt/tests/test_wrapper.py'
27--- breezy/plugins/quilt/tests/test_wrapper.py 2019-06-15 11:47:16 +0000
28+++ breezy/plugins/quilt/tests/test_wrapper.py 2019-08-31 10:25:49 +0000
29@@ -23,6 +23,7 @@
30 import os
31
32 from ..wrapper import (
33+ quilt_delete,
34 quilt_pop_all,
35 quilt_applied,
36 quilt_unapplied,
37@@ -71,7 +72,7 @@
38 self.make_empty_quilt_dir("source")
39 quilt_push_all("source", quiet=True)
40
41- def test_poph_all_empty(self):
42+ def test_pop_all_empty(self):
43 self.make_empty_quilt_dir("source")
44 quilt_pop_all("source", quiet=True)
45
46@@ -97,3 +98,18 @@
47 ("source/patches/patch2.diff", "bazb ar")])
48 self.assertEquals(["patch1.diff", "patch2.diff"],
49 quilt_unapplied("source", "patches"))
50+
51+ def test_delete(self):
52+ source = self.make_empty_quilt_dir("source")
53+ self.build_tree_contents([
54+ ("source/patches/series", "patch1.diff\npatch2.diff"),
55+ ("source/patches/patch1.diff", "foob ar"),
56+ ("source/patches/patch2.diff", "bazb ar")])
57+ quilt_delete("source", "patch1.diff", "patches", remove=False)
58+ self.assertEqual(
59+ ['patch2.diff'],
60+ quilt_series(source, 'patches/series'))
61+ quilt_delete("source", "patch2.diff", "patches", remove=True)
62+ self.assertTrue(os.path.exists('source/patches/patch1.diff'))
63+ self.assertFalse(os.path.exists('source/patches/patch2.diff'))
64+ self.assertEqual([], quilt_series(source, 'patches/series'))
65
66=== modified file 'breezy/plugins/quilt/wrapper.py'
67--- breezy/plugins/quilt/wrapper.py 2019-06-16 13:10:54 +0000
68+++ breezy/plugins/quilt/wrapper.py 2019-08-31 10:25:49 +0000
69@@ -159,19 +159,45 @@
70 patches_dir=patches_dir, series_file=series_file, quiet=quiet)
71
72
73-def quilt_push(working_dir, patch, patches_dir=None, series_file=None, quiet=None):
74+def quilt_push(working_dir, patch, patches_dir=None, series_file=None,
75+ quiet=None, force=False, refresh=False):
76 """Push a patch.
77
78 :param working_dir: Directory to work in
79 :param patch: Patch to push
80 :param patches_dir: Optional patches directory
81 :param series_file: Optional series file
82+ :param force: Force push
83+ :param refresh: Refresh
84 """
85+ args = []
86+ if force:
87+ args.append("-f")
88+ if refresh:
89+ args.append("--refresh")
90 return run_quilt(
91- ["push", patch], working_dir=working_dir,
92+ ["push", patch] + args, working_dir=working_dir,
93 patches_dir=patches_dir, series_file=series_file, quiet=quiet)
94
95
96+def quilt_delete(working_dir, patch, patches_dir=None, series_file=None,
97+ remove=False):
98+ """Delete a patch.
99+
100+ :param working_dir: Directory to work in
101+ :param patch: Patch to push
102+ :param patches_dir: Optional patches directory
103+ :param series_file: Optional series file
104+ :param remove: Remove the patch file as well
105+ """
106+ args = []
107+ if remove:
108+ args.append("-r")
109+ return run_quilt(
110+ ["delete", patch] + args, working_dir=working_dir,
111+ patches_dir=patches_dir, series_file=series_file)
112+
113+
114 def quilt_upgrade(working_dir):
115 return run_quilt(["upgrade"], working_dir=working_dir)
116

Subscribers

People subscribed via source and target branches