##// END OF EJS Templates
allow qrefresh to take a list of files; closes #96.
Brendan Cully -
r2938:5b7a118f default
parent child Browse files
Show More
@@ -912,7 +912,7 b' class queue:'
912 qp = self.qparents(repo, top)
912 qp = self.qparents(repo, top)
913 self.printdiff(repo, qp, files=pats, opts=opts)
913 self.printdiff(repo, qp, files=pats, opts=opts)
914
914
915 def refresh(self, repo, msg='', short=False):
915 def refresh(self, repo, pats=None, **opts):
916 if len(self.applied) == 0:
916 if len(self.applied) == 0:
917 self.ui.write("No patches applied\n")
917 self.ui.write("No patches applied\n")
918 return
918 return
@@ -925,7 +925,7 b' class queue:'
925 message, comments, user, date, patchfound = self.readheaders(patch)
925 message, comments, user, date, patchfound = self.readheaders(patch)
926
926
927 patchf = self.opener(patch, "w")
927 patchf = self.opener(patch, "w")
928 msg = msg.rstrip()
928 msg = opts.get('msg', '').rstrip()
929 if msg:
929 if msg:
930 if comments:
930 if comments:
931 # Remove existing message.
931 # Remove existing message.
@@ -939,6 +939,7 b' class queue:'
939 comments = "\n".join(comments) + '\n\n'
939 comments = "\n".join(comments) + '\n\n'
940 patchf.write(comments)
940 patchf.write(comments)
941
941
942 fns, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
942 tip = repo.changelog.tip()
943 tip = repo.changelog.tip()
943 if top == tip:
944 if top == tip:
944 # if the top of our patch queue is also the tip, there is an
945 # if the top of our patch queue is also the tip, there is an
@@ -956,7 +957,7 b' class queue:'
956 # caching against the next repo.status call
957 # caching against the next repo.status call
957 #
958 #
958 mm, aa, dd, aa2, uu = repo.status(patchparent, tip)[:5]
959 mm, aa, dd, aa2, uu = repo.status(patchparent, tip)[:5]
959 if short:
960 if opts.get('short'):
960 filelist = mm + aa + dd
961 filelist = mm + aa + dd
961 else:
962 else:
962 filelist = None
963 filelist = None
@@ -992,7 +993,7 b' class queue:'
992 m = list(util.unique(mm))
993 m = list(util.unique(mm))
993 r = list(util.unique(dd))
994 r = list(util.unique(dd))
994 a = list(util.unique(aa))
995 a = list(util.unique(aa))
995 filelist = list(util.unique(m + r + a))
996 filelist = filter(matchfn, util.unique(m + r + a))
996 self.printdiff(repo, patchparent, files=filelist,
997 self.printdiff(repo, patchparent, files=filelist,
997 changes=(m, a, r, [], u), fp=patchf)
998 changes=(m, a, r, [], u), fp=patchf)
998 patchf.close()
999 patchf.close()
@@ -1004,7 +1005,15 b' class queue:'
1004 for dst, src in copies:
1005 for dst, src in copies:
1005 repo.dirstate.copy(src, dst)
1006 repo.dirstate.copy(src, dst)
1006 repo.dirstate.update(r, 'r')
1007 repo.dirstate.update(r, 'r')
1008 # if the patch excludes a modified file, mark that file with mtime=0
1009 # so status can see it.
1010 mm = []
1011 for i in range(len(m)-1, -1, -1):
1012 if not matchfn(m[i]):
1013 mm.append(m[i])
1014 del m[i]
1007 repo.dirstate.update(m, 'n')
1015 repo.dirstate.update(m, 'n')
1016 repo.dirstate.update(mm, 'n', st_mtime=0)
1008 repo.dirstate.forget(forget)
1017 repo.dirstate.forget(forget)
1009
1018
1010 if not msg:
1019 if not msg:
@@ -1423,7 +1432,7 b' def new(ui, repo, patch, **opts):'
1423 q.save_dirty()
1432 q.save_dirty()
1424 return 0
1433 return 0
1425
1434
1426 def refresh(ui, repo, **opts):
1435 def refresh(ui, repo, *pats, **opts):
1427 """update the current patch"""
1436 """update the current patch"""
1428 q = repo.mq
1437 q = repo.mq
1429 message = commands.logmessage(opts)
1438 message = commands.logmessage(opts)
@@ -1433,7 +1442,7 b' def refresh(ui, repo, **opts):'
1433 patch = q.applied[-1].name
1442 patch = q.applied[-1].name
1434 (message, comment, user, date, hasdiff) = q.readheaders(patch)
1443 (message, comment, user, date, hasdiff) = q.readheaders(patch)
1435 message = ui.edit('\n'.join(message), user or ui.username())
1444 message = ui.edit('\n'.join(message), user or ui.username())
1436 q.refresh(repo, msg=message, short=opts['short'])
1445 q.refresh(repo, pats, msg=message, **opts)
1437 q.save_dirty()
1446 q.save_dirty()
1438 return 0
1447 return 0
1439
1448
@@ -1942,8 +1951,10 b' cmdtable = {'
1942 [('e', 'edit', None, _('edit commit message')),
1951 [('e', 'edit', None, _('edit commit message')),
1943 ('m', 'message', '', _('change commit message with <text>')),
1952 ('m', 'message', '', _('change commit message with <text>')),
1944 ('l', 'logfile', '', _('change commit message with <file> content')),
1953 ('l', 'logfile', '', _('change commit message with <file> content')),
1945 ('s', 'short', None, 'short refresh')],
1954 ('s', 'short', None, 'short refresh'),
1946 'hg qrefresh [-e] [-m TEXT] [-l FILE] [-s]'),
1955 ('I', 'include', [], _('include names matching the given patterns')),
1956 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
1957 'hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] FILES...'),
1947 'qrename|qmv':
1958 'qrename|qmv':
1948 (rename, [], 'hg qrename PATCH1 [PATCH2]'),
1959 (rename, [], 'hg qrename PATCH1 [PATCH2]'),
1949 "qrestore":
1960 "qrestore":
General Comments 0
You need to be logged in to leave comments. Login now