##// END OF EJS Templates
mq: qdiff with the same diff options than qrefresh (issue1350)...
Patrick Mezard -
r10191:99d285ac default
parent child Browse files
Show More
@@ -771,11 +771,13 b' class queue(object):'
771 771 def check_toppatch(self, repo):
772 772 if len(self.applied) > 0:
773 773 top = bin(self.applied[-1].rev)
774 patch = self.applied[-1].name
774 775 pp = repo.dirstate.parents()
775 776 if top not in pp:
776 777 raise util.Abort(_("working directory revision is not qtip"))
777 return top
778 return None
778 return top, patch
779 return None, None
780
779 781 def check_localchanges(self, repo, force=False, refresh=True):
780 782 m, a, r, d = repo.status()[:4]
781 783 if m or a or r or d:
@@ -1125,7 +1127,7 b' class queue(object):'
1125 1127 end = len(self.applied)
1126 1128 rev = bin(self.applied[start].rev)
1127 1129 if update:
1128 top = self.check_toppatch(repo)
1130 top = self.check_toppatch(repo)[0]
1129 1131
1130 1132 try:
1131 1133 heads = repo.changelog.heads(rev)
@@ -1174,7 +1176,7 b' class queue(object):'
1174 1176 wlock.release()
1175 1177
1176 1178 def diff(self, repo, pats, opts):
1177 top = self.check_toppatch(repo)
1179 top, patch = self.check_toppatch(repo)
1178 1180 if not top:
1179 1181 self.ui.write(_("no patches applied\n"))
1180 1182 return
@@ -1183,7 +1185,7 b' class queue(object):'
1183 1185 node1, node2 = None, qp
1184 1186 else:
1185 1187 node1, node2 = qp, None
1186 diffopts = self.diffopts(opts)
1188 diffopts = self.diffopts(opts, patch)
1187 1189 self.printdiff(repo, diffopts, node1, node2, files=pats, opts=opts)
1188 1190
1189 1191 def refresh(self, repo, pats=None, **opts):
@@ -2058,7 +2060,7 b' def fold(ui, repo, *files, **opts):'
2058 2060
2059 2061 if not files:
2060 2062 raise util.Abort(_('qfold requires at least one patch name'))
2061 if not q.check_toppatch(repo):
2063 if not q.check_toppatch(repo)[0]:
2062 2064 raise util.Abort(_('No patches applied'))
2063 2065 q.check_localchanges(repo)
2064 2066
@@ -2,6 +2,8 b''
2 2
3 3 echo "[extensions]" >> $HGRCPATH
4 4 echo "mq=" >> $HGRCPATH
5 echo "[mq]" >> $HGRCPATH
6 echo "git=keep" >> $HGRCPATH
5 7
6 8 echo % init
7 9 hg init a
@@ -60,3 +62,9 b' hg qdiff --nodates -w'
60 62
61 63 echo % qdiff --reverse
62 64 hg qdiff --nodates --reverse
65
66 echo % qdiff preserve existing git flag
67 hg qrefresh --git
68 echo a >> lines
69 hg qdiff
70
@@ -103,3 +103,22 b' diff -r 35fb829491c1 lines'
103 103 7
104 104 8
105 105 9
106 % qdiff preserve existing git flag
107 diff --git a/lines b/lines
108 --- a/lines
109 +++ b/lines
110 @@ -1,9 +1,12 @@
111 +
112 +
113 1
114 2
115 3
116 4
117 -hello world
118 -goodbye world
119 +hello world
120 + goodbye world
121 7
122 8
123 9
124 +a
General Comments 0
You need to be logged in to leave comments. Login now