Show More
@@ -56,10 +56,7 b' class statusentry:' | |||
|
56 | 56 | class queue: |
|
57 | 57 | def __init__(self, ui, path, patchdir=None): |
|
58 | 58 | self.basepath = path |
|
59 | if patchdir: | |
|
60 | self.path = patchdir | |
|
61 | else: | |
|
62 | self.path = os.path.join(path, "patches") | |
|
59 | self.path = patchdir or os.path.join(path, "patches") | |
|
63 | 60 | self.opener = util.opener(self.path) |
|
64 | 61 | self.ui = ui |
|
65 | 62 | self.applied = [] |
@@ -69,14 +66,17 b' class queue:' | |||
|
69 | 66 | self.series_path = "series" |
|
70 | 67 | self.status_path = "status" |
|
71 | 68 | |
|
72 |
if os.path.exists( |
|
|
69 | if os.path.exists(self.join(self.series_path)): | |
|
73 | 70 | self.full_series = self.opener(self.series_path).read().splitlines() |
|
74 | 71 | self.parse_series() |
|
75 | 72 | |
|
76 |
if os.path.exists( |
|
|
73 | if os.path.exists(self.join(self.status_path)): | |
|
77 | 74 | self.applied = [statusentry(l) |
|
78 | 75 | for l in self.opener(self.status_path).read().splitlines()] |
|
79 | 76 | |
|
77 | def join(self, *p): | |
|
78 | return os.path.join(self.path, *p) | |
|
79 | ||
|
80 | 80 | def find_series(self, patch): |
|
81 | 81 | pre = re.compile("(\s*)([^#]+)") |
|
82 | 82 | index = 0 |
@@ -124,7 +124,7 b' class queue:' | |||
|
124 | 124 | else: |
|
125 | 125 | break |
|
126 | 126 | |
|
127 |
pf = |
|
|
127 | pf = self.join(patch) | |
|
128 | 128 | message = [] |
|
129 | 129 | comments = [] |
|
130 | 130 | user = None |
@@ -390,7 +390,7 b' class queue:' | |||
|
390 | 390 | if r: |
|
391 | 391 | r.remove([patch], True) |
|
392 | 392 | else: |
|
393 |
os.unlink( |
|
|
393 | os.unlink(self.join(patch)) | |
|
394 | 394 | i = self.find_series(patch) |
|
395 | 395 | del self.full_series[i] |
|
396 | 396 | self.parse_series() |
@@ -409,7 +409,7 b' class queue:' | |||
|
409 | 409 | if c or a or d or r: |
|
410 | 410 | raise util.Abort(_("local changes found, refresh first")) |
|
411 | 411 | def new(self, repo, patch, msg=None, force=None): |
|
412 |
if os.path.exists( |
|
|
412 | if os.path.exists(self.join(patch)): | |
|
413 | 413 | raise util.Abort(_('patch "%s" already exists') % patch) |
|
414 | 414 | commitfiles = [] |
|
415 | 415 | (c, a, r, d, u) = repo.changes(None, None) |
@@ -632,7 +632,7 b' class queue:' | |||
|
632 | 632 | if res and res == patch: |
|
633 | 633 | return res |
|
634 | 634 | |
|
635 |
if not os.path.isfile( |
|
|
635 | if not os.path.isfile(self.join(patch)): | |
|
636 | 636 | try: |
|
637 | 637 | sno = int(patch) |
|
638 | 638 | except(ValueError, OverflowError): |
@@ -966,7 +966,7 b' class queue:' | |||
|
966 | 966 | return True |
|
967 | 967 | |
|
968 | 968 | def qrepo(self, create=False): |
|
969 |
if create or os.path.isdir( |
|
|
969 | if create or os.path.isdir(self.join(".hg")): | |
|
970 | 970 | return hg.repository(self.ui, path=self.path, create=create) |
|
971 | 971 | |
|
972 | 972 | def restore(self, repo, rev, delete=None, qupdate=None): |
@@ -1126,7 +1126,7 b' class queue:' | |||
|
1126 | 1126 | if existing: |
|
1127 | 1127 | if not patch: |
|
1128 | 1128 | patch = filename |
|
1129 |
if not os.path.isfile( |
|
|
1129 | if not os.path.isfile(self.join(patch)): | |
|
1130 | 1130 | raise util.Abort(_("patch %s does not exist") % patch) |
|
1131 | 1131 | else: |
|
1132 | 1132 | try: |
@@ -1135,7 +1135,7 b' class queue:' | |||
|
1135 | 1135 | raise util.Abort(_("unable to read %s") % patch) |
|
1136 | 1136 | if not patch: |
|
1137 | 1137 | patch = os.path.split(filename)[1] |
|
1138 |
if not force and os.path.exists( |
|
|
1138 | if not force and os.path.exists(self.join(patch)): | |
|
1139 | 1139 | raise util.Abort(_('patch "%s" already exists') % patch) |
|
1140 | 1140 | patchf = self.opener(patch, "w") |
|
1141 | 1141 | patchf.write(text) |
@@ -1350,7 +1350,7 b' def fold(ui, repo, *files, **opts):' | |||
|
1350 | 1350 | for patch in patches: |
|
1351 | 1351 | if not message: |
|
1352 | 1352 | messages.append(q.readheaders(patch)[0]) |
|
1353 |
pf = |
|
|
1353 | pf = q.join(patch) | |
|
1354 | 1354 | (patchsuccess, files, fuzz) = q.patch(repo, pf) |
|
1355 | 1355 | if not patchsuccess: |
|
1356 | 1356 | raise util.Abort(_('Error folding patch %s') % patch) |
@@ -1461,7 +1461,7 b' def rename(ui, repo, patch, name=None, *' | |||
|
1461 | 1461 | if name in q.series: |
|
1462 | 1462 | raise util.Abort(_('A patch named %s already exists in the series file') % name) |
|
1463 | 1463 | |
|
1464 |
absdest = |
|
|
1464 | absdest = q.join(name) | |
|
1465 | 1465 | if os.path.exists(absdest): |
|
1466 | 1466 | raise util.Abort(_('%s already exists') % absdest) |
|
1467 | 1467 | |
@@ -1485,7 +1485,7 b' def rename(ui, repo, patch, name=None, *' | |||
|
1485 | 1485 | q.applied[info[0]] = statusentry(info[1], name) |
|
1486 | 1486 | q.applied_dirty = 1 |
|
1487 | 1487 | |
|
1488 |
util.rename( |
|
|
1488 | util.rename(q.join(patch), absdest) | |
|
1489 | 1489 | r = q.qrepo() |
|
1490 | 1490 | if r: |
|
1491 | 1491 | wlock = r.wlock() |
@@ -1530,7 +1530,7 b' def save(ui, repo, **opts):' | |||
|
1530 | 1530 | util.copyfiles(path, newpath) |
|
1531 | 1531 | if opts['empty']: |
|
1532 | 1532 | try: |
|
1533 |
os.unlink( |
|
|
1533 | os.unlink(q.join(q.status_path)) | |
|
1534 | 1534 | except: |
|
1535 | 1535 | pass |
|
1536 | 1536 | return 0 |
General Comments 0
You need to be logged in to leave comments.
Login now