Show More
@@ -17,28 +17,26 b' repomap = {}' | |||||
17 |
|
17 | |||
18 | class queue: |
|
18 | class queue: | |
19 | def __init__(self, ui, path, patchdir=None): |
|
19 | def __init__(self, ui, path, patchdir=None): | |
20 | self.opener = util.opener(path) |
|
|||
21 | self.basepath = path |
|
20 | self.basepath = path | |
22 | if patchdir: |
|
21 | if patchdir: | |
23 | self.path = patchdir |
|
22 | self.path = patchdir | |
24 | else: |
|
23 | else: | |
25 | self.path = os.path.join(path, "patches") |
|
24 | self.path = os.path.join(path, "patches") | |
|
25 | self.opener = util.opener(self.path) | |||
26 | self.ui = ui |
|
26 | self.ui = ui | |
27 | self.applied = [] |
|
27 | self.applied = [] | |
28 | self.full_series = [] |
|
28 | self.full_series = [] | |
29 | self.applied_dirty = 0 |
|
29 | self.applied_dirty = 0 | |
30 | self.series_dirty = 0 |
|
30 | self.series_dirty = 0 | |
31 |
self.series_path = |
|
31 | self.series_path = "series" | |
32 |
self.status_path = |
|
32 | self.status_path = "status" | |
33 |
|
33 | |||
34 | s = self.series_path |
|
34 | if os.path.exists(os.path.join(self.path, self.series_path)): | |
35 | if os.path.exists(s): |
|
35 | self.full_series = self.opener(self.series_path).read().splitlines() | |
36 | self.full_series = self.opener(s).read().splitlines() |
|
|||
37 | self.read_series(self.full_series) |
|
36 | self.read_series(self.full_series) | |
38 |
|
37 | |||
39 | s = self.status_path |
|
38 | if os.path.exists(os.path.join(self.path, self.status_path)): | |
40 | if os.path.exists(s): |
|
39 | self.applied = self.opener(self.status_path).read().splitlines() | |
41 | self.applied = self.opener(s).read().splitlines() |
|
|||
42 |
|
40 | |||
43 | def find_series(self, patch): |
|
41 | def find_series(self, patch): | |
44 | pre = re.compile("(\s*)([^#]+)") |
|
42 | pre = re.compile("(\s*)([^#]+)") | |
@@ -186,7 +184,7 b' class queue:' | |||||
186 | self.ui.warn("Unable to read %s\n" % patch) |
|
184 | self.ui.warn("Unable to read %s\n" % patch) | |
187 | sys.exit(1) |
|
185 | sys.exit(1) | |
188 |
|
186 | |||
189 |
patchf = self.opener( |
|
187 | patchf = self.opener(patch, "w") | |
190 | if comments: |
|
188 | if comments: | |
191 | comments = "\n".join(comments) + '\n\n' |
|
189 | comments = "\n".join(comments) + '\n\n' | |
192 | patchf.write(comments) |
|
190 | patchf.write(comments) | |
@@ -402,7 +400,7 b' class queue:' | |||||
402 | self.read_series(self.full_series) |
|
400 | self.read_series(self.full_series) | |
403 | self.series_dirty = 1 |
|
401 | self.series_dirty = 1 | |
404 | self.applied_dirty = 1 |
|
402 | self.applied_dirty = 1 | |
405 |
p = self.opener( |
|
403 | p = self.opener(patch, "w") | |
406 | if msg: |
|
404 | if msg: | |
407 | msg = msg + "\n" |
|
405 | msg = msg + "\n" | |
408 | p.write(msg) |
|
406 | p.write(msg) | |
@@ -716,7 +714,7 b' class queue:' | |||||
716 | patchparent = self.qparents(repo, top) |
|
714 | patchparent = self.qparents(repo, top) | |
717 | message, comments, user, patchfound = self.readheaders(patch) |
|
715 | message, comments, user, patchfound = self.readheaders(patch) | |
718 |
|
716 | |||
719 |
patchf = self.opener( |
|
717 | patchf = self.opener(patch, "w") | |
720 | if comments: |
|
718 | if comments: | |
721 | comments = "\n".join(comments) + '\n\n' |
|
719 | comments = "\n".join(comments) + '\n\n' | |
722 | patchf.write(comments) |
|
720 | patchf.write(comments) | |
@@ -835,8 +833,9 b' class queue:' | |||||
835 | d = root[len(self.path) + 1:] |
|
833 | d = root[len(self.path) + 1:] | |
836 | for f in files: |
|
834 | for f in files: | |
837 | fl = os.path.join(d, f) |
|
835 | fl = os.path.join(d, f) | |
838 |
if (fl not in self.series and |
|
836 | if (fl not in self.series and | |
839 | fl != "series" and not fl.startswith('.')): |
|
837 | fl not in (self.status_path, self.series_path) | |
|
838 | and not fl.startswith('.')): | |||
840 | list.append(fl) |
|
839 | list.append(fl) | |
841 | list.sort() |
|
840 | list.sort() | |
842 | if list: |
|
841 | if list: | |
@@ -1012,7 +1011,7 b' class queue:' | |||||
1012 | if not force and os.path.isfile(os.path.join(self.path, patch)): |
|
1011 | if not force and os.path.isfile(os.path.join(self.path, patch)): | |
1013 | self.ui.warn("patch %s already exists\n" % patch) |
|
1012 | self.ui.warn("patch %s already exists\n" % patch) | |
1014 | sys.exit(1) |
|
1013 | sys.exit(1) | |
1015 |
patchf = self.opener( |
|
1014 | patchf = self.opener(patch, "w") | |
1016 | patchf.write(text) |
|
1015 | patchf.write(text) | |
1017 | if patch in self.series: |
|
1016 | if patch in self.series: | |
1018 | self.ui.warn("patch %s is already in the series file\n" % patch) |
|
1017 | self.ui.warn("patch %s is already in the series file\n" % patch) | |
@@ -1205,7 +1204,7 b' def save(ui, repo, **opts):' | |||||
1205 | util.copyfiles(path, newpath) |
|
1204 | util.copyfiles(path, newpath) | |
1206 | if opts['empty']: |
|
1205 | if opts['empty']: | |
1207 | try: |
|
1206 | try: | |
1208 | os.unlink(q.status_path) |
|
1207 | os.unlink(os.path.join(q.path, q.status_path)) | |
1209 | except: |
|
1208 | except: | |
1210 | pass |
|
1209 | pass | |
1211 | return 0 |
|
1210 | return 0 |
General Comments 0
You need to be logged in to leave comments.
Login now