Show More
@@ -30,7 +30,7 b' class queue:' | |||||
30 | self.series_dirty = 0 |
|
30 | self.series_dirty = 0 | |
31 | self.series_path = os.path.join(self.path, "series") |
|
31 | self.series_path = os.path.join(self.path, "series") | |
32 | self.status_path = os.path.join(self.path, "status") |
|
32 | self.status_path = os.path.join(self.path, "status") | |
33 |
|
33 | |||
34 | s = self.series_path |
|
34 | s = self.series_path | |
35 | if os.path.exists(s): |
|
35 | if os.path.exists(s): | |
36 | self.full_series = self.opener(s).read().splitlines() |
|
36 | self.full_series = self.opener(s).read().splitlines() | |
@@ -65,7 +65,7 b' class queue:' | |||||
65 | yield s |
|
65 | yield s | |
66 | self.series = [] |
|
66 | self.series = [] | |
67 | self.series = [ x for x in matcher(list) ] |
|
67 | self.series = [ x for x in matcher(list) ] | |
68 |
|
68 | |||
69 | def save_dirty(self): |
|
69 | def save_dirty(self): | |
70 | if self.applied_dirty: |
|
70 | if self.applied_dirty: | |
71 | if len(self.applied) > 0: |
|
71 | if len(self.applied) > 0: | |
@@ -86,9 +86,9 b' class queue:' | |||||
86 | def eatdiff(lines): |
|
86 | def eatdiff(lines): | |
87 | while lines: |
|
87 | while lines: | |
88 | l = lines[-1] |
|
88 | l = lines[-1] | |
89 |
if l.startswith("diff -") or |
|
89 | if (l.startswith("diff -") or | |
90 |
l.startswith("Index:") or |
|
90 | l.startswith("Index:") or | |
91 | l.startswith("==========="): |
|
91 | l.startswith("===========")): | |
92 | del lines[-1] |
|
92 | del lines[-1] | |
93 | else: |
|
93 | else: | |
94 | break |
|
94 | break | |
@@ -126,14 +126,12 b' class queue:' | |||||
126 | format = None |
|
126 | format = None | |
127 | elif line == '# HG changeset patch': |
|
127 | elif line == '# HG changeset patch': | |
128 | format = "hgpatch" |
|
128 | format = "hgpatch" | |
129 |
elif format != "tagdone" and |
|
129 | elif (format != "tagdone" and (line.startswith("Subject: ") or | |
130 |
|
|
130 | line.startswith("subject: "))): | |
131 | line.startswith("subject: ")): |
|
|||
132 | subject = line[9:] |
|
131 | subject = line[9:] | |
133 | format = "tag" |
|
132 | format = "tag" | |
134 |
elif format != "tagdone" and |
|
133 | elif (format != "tagdone" and (line.startswith("From: ") or | |
135 |
|
|
134 | line.startswith("from: "))): | |
136 | line.startswith("from: ")): |
|
|||
137 | user = line[6:] |
|
135 | user = line[6:] | |
138 | format = "tag" |
|
136 | format = "tag" | |
139 | elif format == "tag" and line == "": |
|
137 | elif format == "tag" and line == "": | |
@@ -157,7 +155,7 b' class queue:' | |||||
157 |
|
155 | |||
158 | def mergeone(self, repo, mergeq, head, patch, rev, wlock): |
|
156 | def mergeone(self, repo, mergeq, head, patch, rev, wlock): | |
159 | # first try just applying the patch |
|
157 | # first try just applying the patch | |
160 |
(err, n) = self.apply(repo, [ patch ], update_status=False, |
|
158 | (err, n) = self.apply(repo, [ patch ], update_status=False, | |
161 | strict=True, merge=rev, wlock=wlock) |
|
159 | strict=True, merge=rev, wlock=wlock) | |
162 |
|
160 | |||
163 | if err == 0: |
|
161 | if err == 0: | |
@@ -195,7 +193,7 b' class queue:' | |||||
195 | commands.dodiff(patchf, self.ui, repo, head, n) |
|
193 | commands.dodiff(patchf, self.ui, repo, head, n) | |
196 | patchf.close() |
|
194 | patchf.close() | |
197 | return (0, n) |
|
195 | return (0, n) | |
198 |
|
196 | |||
199 | def qparents(self, repo, rev=None): |
|
197 | def qparents(self, repo, rev=None): | |
200 | if rev is None: |
|
198 | if rev is None: | |
201 | (p1, p2) = repo.dirstate.parents() |
|
199 | (p1, p2) = repo.dirstate.parents() | |
@@ -253,7 +251,7 b' class queue:' | |||||
253 | return (err, head) |
|
251 | return (err, head) | |
254 | return (0, head) |
|
252 | return (0, head) | |
255 |
|
253 | |||
256 |
def apply(self, repo, series, list=False, update_status=True, |
|
254 | def apply(self, repo, series, list=False, update_status=True, | |
257 | strict=False, patchdir=None, merge=None, wlock=None): |
|
255 | strict=False, patchdir=None, merge=None, wlock=None): | |
258 | # TODO unify with commands.py |
|
256 | # TODO unify with commands.py | |
259 | if not patchdir: |
|
257 | if not patchdir: | |
@@ -285,8 +283,7 b' class queue:' | |||||
285 | message = '\n'.join(message) |
|
283 | message = '\n'.join(message) | |
286 |
|
284 | |||
287 | try: |
|
285 | try: | |
288 | f = os.popen("patch -p1 --no-backup-if-mismatch < '%s'" % |
|
286 | f = os.popen("patch -p1 --no-backup-if-mismatch < '%s'" % (pf)) | |
289 | (pf)) |
|
|||
290 | except: |
|
287 | except: | |
291 | self.ui.warn("patch failed, unable to continue (try -v)\n") |
|
288 | self.ui.warn("patch failed, unable to continue (try -v)\n") | |
292 | err = 1 |
|
289 | err = 1 | |
@@ -299,7 +296,7 b' class queue:' | |||||
299 | self.ui.warn(l + "\n") |
|
296 | self.ui.warn(l + "\n") | |
300 | if l[:14] == 'patching file ': |
|
297 | if l[:14] == 'patching file ': | |
301 | pf = os.path.normpath(l[14:]) |
|
298 | pf = os.path.normpath(l[14:]) | |
302 |
# when patch finds a space in the file name, it puts |
|
299 | # when patch finds a space in the file name, it puts | |
303 | # single quotes around the filename. strip them off |
|
300 | # single quotes around the filename. strip them off | |
304 | if pf[0] == "'" and pf[-1] == "'": |
|
301 | if pf[0] == "'" and pf[-1] == "'": | |
305 | pf = pf[1:-1] |
|
302 | pf = pf[1:-1] | |
@@ -323,12 +320,12 b' class queue:' | |||||
323 | patcherr = f.close() |
|
320 | patcherr = f.close() | |
324 |
|
321 | |||
325 | if merge and len(files) > 0: |
|
322 | if merge and len(files) > 0: | |
326 |
|
|
323 | # Mark as merged and update dirstate parent info | |
327 |
|
|
324 | repo.dirstate.update(repo.dirstate.filterfiles(files), 'm') | |
328 |
|
|
325 | p1, p2 = repo.dirstate.parents() | |
329 |
|
|
326 | repo.dirstate.setparents(p1, merge) | |
330 | if len(files) > 0: |
|
327 | if len(files) > 0: | |
331 |
commands.addremove_lock(self.ui, repo, files, |
|
328 | commands.addremove_lock(self.ui, repo, files, | |
332 | opts={}, wlock=wlock) |
|
329 | opts={}, wlock=wlock) | |
333 | n = repo.commit(files, message, user, force=1, lock=lock, |
|
330 | n = repo.commit(files, message, user, force=1, lock=lock, | |
334 | wlock=wlock) |
|
331 | wlock=wlock) | |
@@ -370,7 +367,7 b' class queue:' | |||||
370 | del self.full_series[i] |
|
367 | del self.full_series[i] | |
371 | self.read_series(self.full_series) |
|
368 | self.read_series(self.full_series) | |
372 | self.series_dirty = 1 |
|
369 | self.series_dirty = 1 | |
373 |
|
370 | |||
374 | def check_toppatch(self, repo): |
|
371 | def check_toppatch(self, repo): | |
375 | if len(self.applied) > 0: |
|
372 | if len(self.applied) > 0: | |
376 | (top, patch) = self.applied[-1].split(':') |
|
373 | (top, patch) = self.applied[-1].split(':') | |
@@ -393,9 +390,10 b' class queue:' | |||||
393 | wlock = repo.wlock() |
|
390 | wlock = repo.wlock() | |
394 | insert = self.series_end() |
|
391 | insert = self.series_end() | |
395 | if msg: |
|
392 | if msg: | |
396 | n = repo.commit([], "[mq]: %s" % msg, force=True, wlock=wlock) |
|
393 | n = repo.commit([], "[mq]: %s" % msg, force=True, wlock=wlock) | |
397 | else: |
|
394 | else: | |
398 | n = repo.commit([], "New patch: %s" % patch, force=True, wlock=wlock) |
|
395 | n = repo.commit([], | |
|
396 | "New patch: %s" % patch, force=True, wlock=wlock) | |||
399 | if n == None: |
|
397 | if n == None: | |
400 | self.ui.warn("repo commit failed\n") |
|
398 | self.ui.warn("repo commit failed\n") | |
401 | sys.exit(1) |
|
399 | sys.exit(1) | |
@@ -538,7 +536,7 b' class queue:' | |||||
538 | for x in r: |
|
536 | for x in r: | |
539 | if chlog.rev(x) > revnum: |
|
537 | if chlog.rev(x) > revnum: | |
540 | savebases[x] = 1 |
|
538 | savebases[x] = 1 | |
541 |
|
539 | |||
542 | # create a changegroup for all the branches we need to keep |
|
540 | # create a changegroup for all the branches we need to keep | |
543 | if backup is "all": |
|
541 | if backup is "all": | |
544 | backupch = repo.changegroupsubset([rev], chlog.heads(), 'strip') |
|
542 | backupch = repo.changegroupsubset([rev], chlog.heads(), 'strip') | |
@@ -557,7 +555,7 b' class queue:' | |||||
557 | commands.unbundle(self.ui, repo, chgrpfile, update=False) |
|
555 | commands.unbundle(self.ui, repo, chgrpfile, update=False) | |
558 | if backup is not "strip": |
|
556 | if backup is not "strip": | |
559 | os.unlink(chgrpfile) |
|
557 | os.unlink(chgrpfile) | |
560 |
|
558 | |||
561 | def isapplied(self, patch): |
|
559 | def isapplied(self, patch): | |
562 | """returns (index, rev, patch)""" |
|
560 | """returns (index, rev, patch)""" | |
563 | for i in xrange(len(self.applied)): |
|
561 | for i in xrange(len(self.applied)): | |
@@ -587,11 +585,11 b' class queue:' | |||||
587 | sys.exit(1) |
|
585 | sys.exit(1) | |
588 | return patch |
|
586 | return patch | |
589 |
|
587 | |||
590 |
def push(self, repo, patch=None, force=False, list=False, |
|
588 | def push(self, repo, patch=None, force=False, list=False, | |
591 | mergeq=None, wlock=None): |
|
589 | mergeq=None, wlock=None): | |
592 | if not wlock: |
|
590 | if not wlock: | |
593 | wlock = repo.wlock() |
|
591 | wlock = repo.wlock() | |
594 |
patch = self.lookup(patch) |
|
592 | patch = self.lookup(patch) | |
595 | if patch and self.isapplied(patch): |
|
593 | if patch and self.isapplied(patch): | |
596 | self.ui.warn("patch %s is already applied\n" % patch) |
|
594 | self.ui.warn("patch %s is already applied\n" % patch) | |
597 | sys.exit(1) |
|
595 | sys.exit(1) | |
@@ -600,7 +598,7 b' class queue:' | |||||
600 | sys.exit(1) |
|
598 | sys.exit(1) | |
601 | if not force: |
|
599 | if not force: | |
602 | self.check_localchanges(repo) |
|
600 | self.check_localchanges(repo) | |
603 |
|
601 | |||
604 | self.applied_dirty = 1; |
|
602 | self.applied_dirty = 1; | |
605 | start = self.series_end() |
|
603 | start = self.series_end() | |
606 | if start > 0: |
|
604 | if start > 0: | |
@@ -617,7 +615,7 b' class queue:' | |||||
617 | ret = self.apply(repo, s, list, wlock=wlock) |
|
615 | ret = self.apply(repo, s, list, wlock=wlock) | |
618 | top = self.applied[-1].split(':')[1] |
|
616 | top = self.applied[-1].split(':')[1] | |
619 | if ret[0]: |
|
617 | if ret[0]: | |
620 |
self.ui.write("Errors during apply, please fix and refresh %s\n" % |
|
618 | self.ui.write("Errors during apply, please fix and refresh %s\n" % | |
621 | top) |
|
619 | top) | |
622 | else: |
|
620 | else: | |
623 | self.ui.write("Now at: %s\n" % top) |
|
621 | self.ui.write("Now at: %s\n" % top) | |
@@ -725,20 +723,20 b' class queue:' | |||||
725 |
|
723 | |||
726 | tip = repo.changelog.tip() |
|
724 | tip = repo.changelog.tip() | |
727 | if top == tip: |
|
725 | if top == tip: | |
728 |
# if the top of our patch queue is also the tip, there is an |
|
726 | # if the top of our patch queue is also the tip, there is an | |
729 | # optimization here. We update the dirstate in place and strip |
|
727 | # optimization here. We update the dirstate in place and strip | |
730 | # off the tip commit. Then just commit the current directory |
|
728 | # off the tip commit. Then just commit the current directory | |
731 | # tree. We can also send repo.commit the list of files |
|
729 | # tree. We can also send repo.commit the list of files | |
732 | # changed to speed up the diff |
|
730 | # changed to speed up the diff | |
733 | # |
|
731 | # | |
734 |
# in short mode, we only diff the files included in the |
|
732 | # in short mode, we only diff the files included in the | |
735 | # patch already |
|
733 | # patch already | |
736 | # |
|
734 | # | |
737 | # this should really read: |
|
735 | # this should really read: | |
738 | #(cc, dd, aa, aa2, uu) = repo.changes(tip, patchparent) |
|
736 | #(cc, dd, aa, aa2, uu) = repo.changes(tip, patchparent) | |
739 | # but we do it backwards to take advantage of manifest/chlog |
|
737 | # but we do it backwards to take advantage of manifest/chlog | |
740 | # caching against the next repo.changes call |
|
738 | # caching against the next repo.changes call | |
741 |
# |
|
739 | # | |
742 | (cc, aa, dd, aa2, uu) = repo.changes(patchparent, tip) |
|
740 | (cc, aa, dd, aa2, uu) = repo.changes(patchparent, tip) | |
743 | if short: |
|
741 | if short: | |
744 | filelist = cc + aa + dd |
|
742 | filelist = cc + aa + dd | |
@@ -777,7 +775,7 b' class queue:' | |||||
777 | r = list(util.unique(dd)) |
|
775 | r = list(util.unique(dd)) | |
778 | a = list(util.unique(aa)) |
|
776 | a = list(util.unique(aa)) | |
779 | filelist = list(util.unique(c + r + a )) |
|
777 | filelist = list(util.unique(c + r + a )) | |
780 |
commands.dodiff(patchf, self.ui, repo, patchparent, None, |
|
778 | commands.dodiff(patchf, self.ui, repo, patchparent, None, | |
781 | filelist, changes=(c, a, r, [], u)) |
|
779 | filelist, changes=(c, a, r, [], u)) | |
782 | patchf.close() |
|
780 | patchf.close() | |
783 |
|
781 | |||
@@ -785,7 +783,7 b' class queue:' | |||||
785 | repo.dirstate.setparents(*cparents) |
|
783 | repo.dirstate.setparents(*cparents) | |
786 | repo.dirstate.update(a, 'a') |
|
784 | repo.dirstate.update(a, 'a') | |
787 | repo.dirstate.update(r, 'r') |
|
785 | repo.dirstate.update(r, 'r') | |
788 |
repo.dirstate.update(c, 'n') |
|
786 | repo.dirstate.update(c, 'n') | |
789 | repo.dirstate.forget(forget) |
|
787 | repo.dirstate.forget(forget) | |
790 |
|
788 | |||
791 | if not message: |
|
789 | if not message: | |
@@ -819,7 +817,7 b' class queue:' | |||||
819 | start = self.series.index(patch) + 1 |
|
817 | start = self.series.index(patch) + 1 | |
820 | for p in self.series[start:]: |
|
818 | for p in self.series[start:]: | |
821 | self.ui.write("%s\n" % p) |
|
819 | self.ui.write("%s\n" % p) | |
822 |
|
820 | |||
823 | def qseries(self, repo, missing=None): |
|
821 | def qseries(self, repo, missing=None): | |
824 | start = self.series_end() |
|
822 | start = self.series_end() | |
825 | if not missing: |
|
823 | if not missing: | |
@@ -838,11 +836,11 b' class queue:' | |||||
838 | for f in files: |
|
836 | for f in files: | |
839 | fl = os.path.join(d, f) |
|
837 | fl = os.path.join(d, f) | |
840 | if (fl not in self.series and fl != "status" and |
|
838 | if (fl not in self.series and fl != "status" and | |
841 | fl != "series" and not fl.startswith('.')): |
|
839 | fl != "series" and not fl.startswith('.')): | |
842 | list.append(fl) |
|
840 | list.append(fl) | |
843 | list.sort() |
|
841 | list.sort() | |
844 | if list: |
|
842 | if list: | |
845 |
for x in list: |
|
843 | for x in list: | |
846 | if self.ui.verbose: |
|
844 | if self.ui.verbose: | |
847 | self.ui.write("D ") |
|
845 | self.ui.write("D ") | |
848 | self.ui.write("%s\n" % x) |
|
846 | self.ui.write("%s\n" % x) | |
@@ -902,7 +900,7 b' class queue:' | |||||
902 | update = False |
|
900 | update = False | |
903 | self.strip(repo, rev, update=update, backup='strip') |
|
901 | self.strip(repo, rev, update=update, backup='strip') | |
904 | if qpp: |
|
902 | if qpp: | |
905 |
self.ui.warn("saved queue repository parents: %s %s\n" % |
|
903 | self.ui.warn("saved queue repository parents: %s %s\n" % | |
906 | (hg.short(qpp[0]), hg.short(qpp[1]))) |
|
904 | (hg.short(qpp[0]), hg.short(qpp[1]))) | |
907 | if qupdate: |
|
905 | if qupdate: | |
908 | print "queue directory updating" |
|
906 | print "queue directory updating" | |
@@ -919,7 +917,7 b' class queue:' | |||||
919 | if self.issaveline(self.applied[-1]): |
|
917 | if self.issaveline(self.applied[-1]): | |
920 | self.ui.warn("status is already saved\n") |
|
918 | self.ui.warn("status is already saved\n") | |
921 | return 1 |
|
919 | return 1 | |
922 |
|
920 | |||
923 | ar = [ ':' + x for x in self.full_series ] |
|
921 | ar = [ ':' + x for x in self.full_series ] | |
924 | if not msg: |
|
922 | if not msg: | |
925 | msg = "hg patches saved state" |
|
923 | msg = "hg patches saved state" | |
@@ -930,8 +928,8 b' class queue:' | |||||
930 | pp = r.dirstate.parents() |
|
928 | pp = r.dirstate.parents() | |
931 | msg += "\nDirstate: %s %s" % (hg.hex(pp[0]), hg.hex(pp[1])) |
|
929 | msg += "\nDirstate: %s %s" % (hg.hex(pp[0]), hg.hex(pp[1])) | |
932 | msg += "\n\nPatch Data:\n" |
|
930 | msg += "\n\nPatch Data:\n" | |
933 |
text = msg + "\n".join(self.applied) + '\n' + (ar and "\n".join(ar) |
|
931 | text = msg + "\n".join(self.applied) + '\n' + (ar and "\n".join(ar) | |
934 | + '\n' or "") |
|
932 | + '\n' or "") | |
935 | n = repo.commit(None, text, user=None, force=1) |
|
933 | n = repo.commit(None, text, user=None, force=1) | |
936 | if not n: |
|
934 | if not n: | |
937 | self.ui.warn("repo commit failed\n") |
|
935 | self.ui.warn("repo commit failed\n") | |
@@ -967,7 +965,7 b' class queue:' | |||||
967 | if not self.ui.verbose: |
|
965 | if not self.ui.verbose: | |
968 | p = p.split(':')[1] |
|
966 | p = p.split(':')[1] | |
969 | return p |
|
967 | return p | |
970 |
|
968 | |||
971 | def top(self, repo): |
|
969 | def top(self, repo): | |
972 | if len(self.applied): |
|
970 | if len(self.applied): | |
973 | p = self.appliedname(-1) |
|
971 | p = self.appliedname(-1) | |
@@ -998,7 +996,7 b' class queue:' | |||||
998 | i = 0 |
|
996 | i = 0 | |
999 | for filename in files: |
|
997 | for filename in files: | |
1000 | if existing: |
|
998 | if existing: | |
1001 |
if not patch: |
|
999 | if not patch: | |
1002 | patch = filename |
|
1000 | patch = filename | |
1003 | if not os.path.isfile(os.path.join(self.path, patch)): |
|
1001 | if not os.path.isfile(os.path.join(self.path, patch)): | |
1004 | self.ui.warn("patch %s does not exist\n" % patch) |
|
1002 | self.ui.warn("patch %s does not exist\n" % patch) | |
@@ -1047,8 +1045,8 b' def unapplied(ui, repo, patch=None, **op' | |||||
1047 | def qimport(ui, repo, *filename, **opts): |
|
1045 | def qimport(ui, repo, *filename, **opts): | |
1048 | """import a patch""" |
|
1046 | """import a patch""" | |
1049 | q = repomap[repo] |
|
1047 | q = repomap[repo] | |
1050 |
q.qimport(repo, filename, patch=opts['name'], |
|
1048 | q.qimport(repo, filename, patch=opts['name'], | |
1051 |
|
|
1049 | existing=opts['existing'], force=opts['force']) | |
1052 | q.save_dirty() |
|
1050 | q.save_dirty() | |
1053 | return 0 |
|
1051 | return 0 | |
1054 |
|
1052 | |||
@@ -1127,7 +1125,7 b' def lastsavename(path):' | |||||
1127 | if maxname: |
|
1125 | if maxname: | |
1128 | return (os.path.join(dir, maxname), max) |
|
1126 | return (os.path.join(dir, maxname), max) | |
1129 | return (None, None) |
|
1127 | return (None, None) | |
1130 |
|
1128 | |||
1131 | def savename(path): |
|
1129 | def savename(path): | |
1132 | (last, index) = lastsavename(path) |
|
1130 | (last, index) = lastsavename(path) | |
1133 | if last is None: |
|
1131 | if last is None: | |
@@ -1139,20 +1137,20 b' def push(ui, repo, patch=None, **opts):' | |||||
1139 | """push the next patch onto the stack""" |
|
1137 | """push the next patch onto the stack""" | |
1140 | q = repomap[repo] |
|
1138 | q = repomap[repo] | |
1141 | mergeq = None |
|
1139 | mergeq = None | |
1142 |
|
1140 | |||
1143 | if opts['all']: |
|
1141 | if opts['all']: | |
1144 | patch = q.series[-1] |
|
1142 | patch = q.series[-1] | |
1145 | if opts['merge']: |
|
1143 | if opts['merge']: | |
1146 | if opts['name']: |
|
1144 | if opts['name']: | |
1147 | newpath = opts['name'] |
|
1145 | newpath = opts['name'] | |
1148 | else: |
|
1146 | else: | |
1149 | newpath,i = lastsavename(q.path) |
|
1147 | newpath, i = lastsavename(q.path) | |
1150 | if not newpath: |
|
1148 | if not newpath: | |
1151 | ui.warn("no saved queues found, please use -n\n") |
|
1149 | ui.warn("no saved queues found, please use -n\n") | |
1152 | return 1 |
|
1150 | return 1 | |
1153 | mergeq = queue(ui, repo.join(""), newpath) |
|
1151 | mergeq = queue(ui, repo.join(""), newpath) | |
1154 | ui.warn("merging with queue at: %s\n" % mergeq.path) |
|
1152 | ui.warn("merging with queue at: %s\n" % mergeq.path) | |
1155 |
ret = q.push(repo, patch, force=opts['force'], list=opts['list'], |
|
1153 | ret = q.push(repo, patch, force=opts['force'], list=opts['list'], | |
1156 | mergeq=mergeq) |
|
1154 | mergeq=mergeq) | |
1157 | q.save_dirty() |
|
1155 | q.save_dirty() | |
1158 | return ret |
|
1156 | return ret | |
@@ -1177,7 +1175,7 b' def restore(ui, repo, rev, **opts):' | |||||
1177 | rev = repo.lookup(rev) |
|
1175 | rev = repo.lookup(rev) | |
1178 | q = repomap[repo] |
|
1176 | q = repomap[repo] | |
1179 | q.restore(repo, rev, delete=opts['delete'], |
|
1177 | q.restore(repo, rev, delete=opts['delete'], | |
1180 |
|
|
1178 | qupdate=opts['update']) | |
1181 | q.save_dirty() |
|
1179 | q.save_dirty() | |
1182 | return 0 |
|
1180 | return 0 | |
1183 |
|
1181 | |||
@@ -1195,11 +1193,11 b' def save(ui, repo, **opts):' | |||||
1195 | if os.path.exists(newpath): |
|
1193 | if os.path.exists(newpath): | |
1196 | if not os.path.isdir(newpath): |
|
1194 | if not os.path.isdir(newpath): | |
1197 | ui.warn("destination %s exists and is not a directory\n" % |
|
1195 | ui.warn("destination %s exists and is not a directory\n" % | |
1198 |
|
|
1196 | newpath) | |
1199 | sys.exit(1) |
|
1197 | sys.exit(1) | |
1200 | if not opts['force']: |
|
1198 | if not opts['force']: | |
1201 | ui.warn("destination %s exists, use -f to force\n" % |
|
1199 | ui.warn("destination %s exists, use -f to force\n" % | |
1202 |
|
|
1200 | newpath) | |
1203 | sys.exit(1) |
|
1201 | sys.exit(1) | |
1204 | else: |
|
1202 | else: | |
1205 | newpath = savename(path) |
|
1203 | newpath = savename(path) | |
@@ -1211,7 +1209,7 b' def save(ui, repo, **opts):' | |||||
1211 | except: |
|
1209 | except: | |
1212 | pass |
|
1210 | pass | |
1213 | return 0 |
|
1211 | return 0 | |
1214 |
|
1212 | |||
1215 | def strip(ui, repo, rev, **opts): |
|
1213 | def strip(ui, repo, rev, **opts): | |
1216 | """strip a revision and all later revs on the same branch""" |
|
1214 | """strip a revision and all later revs on the same branch""" | |
1217 | rev = repo.lookup(rev) |
|
1215 | rev = repo.lookup(rev) | |
@@ -1232,55 +1230,79 b' def reposetup(ui, repo):' | |||||
1232 | repomap[repo] = queue(ui, repo.join("")) |
|
1230 | repomap[repo] = queue(ui, repo.join("")) | |
1233 |
|
1231 | |||
1234 | cmdtable = { |
|
1232 | cmdtable = { | |
1235 |
"qapplied": (applied, [], |
|
1233 | "qapplied": (applied, [], 'hg qapplied [patch]'), | |
1236 |
"qcommit|qci": |
|
1234 | "qcommit|qci": | |
1237 | [('A', 'addremove', None, _('run addremove during commit')), |
|
1235 | (commit, | |
1238 | ('I', 'include', [], _('include names matching the given patterns')), |
|
1236 | [('A', 'addremove', None, _('run addremove during commit')), | |
1239 |
|
|
1237 | ('I', 'include', [], _('include names matching the given patterns')), | |
1240 | ('m', 'message', "", _('use <text> as commit message')), |
|
1238 | ('X', 'exclude', [], _('exclude names matching the given patterns')), | |
1241 |
|
|
1239 | ('m', 'message', '', _('use <text> as commit message')), | |
1242 |
|
|
1240 | ('l', 'logfile', '', _('read the commit message from <file>')), | |
1243 |
|
|
1241 | ('d', 'date', '', _('record datecode as commit date')), | |
1244 | "hg qcommit [options] [files]"), |
|
1242 | ('u', 'user', '', _('record user as commiter'))], | |
1245 | "^qdiff": (diff, [], "hg qdiff [files]"), |
|
1243 | 'hg qcommit [options] [files]'), | |
1246 | "qdelete": (delete, [], "hg qdelete [patch]"), |
|
1244 | "^qdiff": (diff, [], 'hg qdiff [files]'), | |
1247 | "^qimport": (qimport, [('e', 'existing', None, 'import file in patch dir'), |
|
1245 | "qdelete": (delete, [], 'hg qdelete [patch]'), | |
1248 | ('n', 'name', "", 'patch file name'), |
|
1246 | "^qimport": | |
1249 | ('f', 'force', None, 'overwrite existing files')], |
|
1247 | (qimport, | |
1250 | "hg qimport"), |
|
1248 | [('e', 'existing', None, 'import file in patch dir'), | |
1251 | "^qinit": (init, [('c', 'create-repo', None, 'create patch repository')], |
|
1249 | ('n', 'name', '', 'patch file name'), | |
1252 | "hg [-c] qinit"), |
|
1250 | ('f', 'force', None, 'overwrite existing files')], | |
1253 | "qnew": (new, [('m', 'message', "", 'commit message'), |
|
1251 | 'hg qimport'), | |
1254 | ('f', 'force', None, 'force')], |
|
1252 | "^qinit": | |
1255 | "hg qnew [-m message ] patch"), |
|
1253 | (init, | |
1256 | "qnext": (next, [], "hg qnext"), |
|
1254 | [('c', 'create-repo', None, 'create patch repository')], | |
1257 | "qprev": (prev, [], "hg qprev"), |
|
1255 | 'hg [-c] qinit'), | |
1258 | "^qpop": (pop, [('a', 'all', None, 'pop all patches'), |
|
1256 | "qnew": | |
1259 | ('n', 'name', "", 'queue name to pop'), |
|
1257 | (new, | |
1260 | ('f', 'force', None, 'forget any local changes')], |
|
1258 | [('m', 'message', '', 'commit message'), | |
1261 | 'hg qpop [options] [patch/index]'), |
|
1259 | ('f', 'force', None, 'force')], | |
1262 | "^qpush": (push, [('f', 'force', None, 'apply if the patch has rejects'), |
|
1260 | 'hg qnew [-m message ] patch'), | |
1263 | ('l', 'list', None, 'list patch name in commit text'), |
|
1261 | "qnext": (next, [], 'hg qnext'), | |
1264 | ('a', 'all', None, 'apply all patches'), |
|
1262 | "qprev": (prev, [], 'hg qprev'), | |
1265 | ('m', 'merge', None, 'merge from another queue'), |
|
1263 | "^qpop": | |
1266 | ('n', 'name', "", 'merge queue name')], |
|
1264 | (pop, | |
1267 | 'hg qpush [options] [patch/index]'), |
|
1265 | [('a', 'all', None, 'pop all patches'), | |
1268 | "^qrefresh": (refresh, [('s', 'short', None, 'short refresh')],"hg qrefresh"), |
|
1266 | ('n', 'name', '', 'queue name to pop'), | |
1269 | "qrestore": (restore, [('d', 'delete', None, 'delete save entry'), |
|
1267 | ('f', 'force', None, 'forget any local changes')], | |
1270 | ('u', 'update', None, 'update queue working dir')], |
|
1268 | 'hg qpop [options] [patch/index]'), | |
1271 | 'hg qrestore rev'), |
|
1269 | "^qpush": | |
1272 | "qsave": (save, [('m', 'message', "", 'commit message'), |
|
1270 | (push, | |
1273 |
|
|
1271 | [('f', 'force', None, 'apply if the patch has rejects'), | |
1274 | ('n', 'name', "", 'copy directory name'), |
|
1272 | ('l', 'list', None, 'list patch name in commit text'), | |
1275 | ('e', 'empty', None, 'clear queue status file'), |
|
1273 | ('a', 'all', None, 'apply all patches'), | |
1276 |
|
|
1274 | ('m', 'merge', None, 'merge from another queue'), | |
1277 | "qseries": (series, [('m', 'missing', None, 'print patches not in series')], |
|
1275 | ('n', 'name', '', 'merge queue name')], | |
1278 | "hg qseries"), |
|
1276 | 'hg qpush [options] [patch/index]'), | |
1279 | "^strip": (strip, [('f', 'force', None, 'force multi-head removal'), |
|
1277 | "^qrefresh": | |
1280 | ('b', 'backup', None, 'bundle unrelated changesets'), |
|
1278 | (refresh, | |
1281 | ('n', 'nobackup', None, 'no backups')], "hg strip rev"), |
|
1279 | [('s', 'short', None, 'short refresh')], | |
1282 | "qtop": (top, [], "hg qtop"), |
|
1280 | 'hg qrefresh'), | |
1283 | "qunapplied": (unapplied, [], "hg qunapplied [patch]"), |
|
1281 | "qrestore": | |
1284 | "qversion": (version, [], "hg qversion") |
|
1282 | (restore, | |
|
1283 | [('d', 'delete', None, 'delete save entry'), | |||
|
1284 | ('u', 'update', None, 'update queue working dir')], | |||
|
1285 | 'hg qrestore rev'), | |||
|
1286 | "qsave": | |||
|
1287 | (save, | |||
|
1288 | [('m', 'message', '', 'commit message'), | |||
|
1289 | ('c', 'copy', None, 'copy patch directory'), | |||
|
1290 | ('n', 'name', '', 'copy directory name'), | |||
|
1291 | ('e', 'empty', None, 'clear queue status file'), | |||
|
1292 | ('f', 'force', None, 'force copy')], | |||
|
1293 | 'hg qsave'), | |||
|
1294 | "qseries": | |||
|
1295 | (series, | |||
|
1296 | [('m', 'missing', None, 'print patches not in series')], | |||
|
1297 | 'hg qseries'), | |||
|
1298 | "^strip": | |||
|
1299 | (strip, | |||
|
1300 | [('f', 'force', None, 'force multi-head removal'), | |||
|
1301 | ('b', 'backup', None, 'bundle unrelated changesets'), | |||
|
1302 | ('n', 'nobackup', None, 'no backups')], | |||
|
1303 | 'hg strip rev'), | |||
|
1304 | "qtop": (top, [], 'hg qtop'), | |||
|
1305 | "qunapplied": (unapplied, [], 'hg qunapplied [patch]'), | |||
|
1306 | "qversion": (version, [], 'hg qversion') | |||
1285 | } |
|
1307 | } | |
1286 |
|
1308 |
@@ -179,7 +179,7 b' def canonpath(root, cwd, myname):' | |||||
179 | if root == os.sep: |
|
179 | if root == os.sep: | |
180 | rootsep = os.sep |
|
180 | rootsep = os.sep | |
181 | else: |
|
181 | else: | |
182 |
|
|
182 | rootsep = root + os.sep | |
183 | name = myname |
|
183 | name = myname | |
184 | if not name.startswith(os.sep): |
|
184 | if not name.startswith(os.sep): | |
185 | name = os.path.join(root, cwd, name) |
|
185 | name = os.path.join(root, cwd, name) |
General Comments 0
You need to be logged in to leave comments.
Login now