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