##// 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 def check_toppatch(self, repo):
771 def check_toppatch(self, repo):
772 if len(self.applied) > 0:
772 if len(self.applied) > 0:
773 top = bin(self.applied[-1].rev)
773 top = bin(self.applied[-1].rev)
774 patch = self.applied[-1].name
774 pp = repo.dirstate.parents()
775 pp = repo.dirstate.parents()
775 if top not in pp:
776 if top not in pp:
776 raise util.Abort(_("working directory revision is not qtip"))
777 raise util.Abort(_("working directory revision is not qtip"))
777 return top
778 return top, patch
778 return None
779 return None, None
780
779 def check_localchanges(self, repo, force=False, refresh=True):
781 def check_localchanges(self, repo, force=False, refresh=True):
780 m, a, r, d = repo.status()[:4]
782 m, a, r, d = repo.status()[:4]
781 if m or a or r or d:
783 if m or a or r or d:
@@ -1125,7 +1127,7 b' class queue(object):'
1125 end = len(self.applied)
1127 end = len(self.applied)
1126 rev = bin(self.applied[start].rev)
1128 rev = bin(self.applied[start].rev)
1127 if update:
1129 if update:
1128 top = self.check_toppatch(repo)
1130 top = self.check_toppatch(repo)[0]
1129
1131
1130 try:
1132 try:
1131 heads = repo.changelog.heads(rev)
1133 heads = repo.changelog.heads(rev)
@@ -1174,7 +1176,7 b' class queue(object):'
1174 wlock.release()
1176 wlock.release()
1175
1177
1176 def diff(self, repo, pats, opts):
1178 def diff(self, repo, pats, opts):
1177 top = self.check_toppatch(repo)
1179 top, patch = self.check_toppatch(repo)
1178 if not top:
1180 if not top:
1179 self.ui.write(_("no patches applied\n"))
1181 self.ui.write(_("no patches applied\n"))
1180 return
1182 return
@@ -1183,7 +1185,7 b' class queue(object):'
1183 node1, node2 = None, qp
1185 node1, node2 = None, qp
1184 else:
1186 else:
1185 node1, node2 = qp, None
1187 node1, node2 = qp, None
1186 diffopts = self.diffopts(opts)
1188 diffopts = self.diffopts(opts, patch)
1187 self.printdiff(repo, diffopts, node1, node2, files=pats, opts=opts)
1189 self.printdiff(repo, diffopts, node1, node2, files=pats, opts=opts)
1188
1190
1189 def refresh(self, repo, pats=None, **opts):
1191 def refresh(self, repo, pats=None, **opts):
@@ -2058,7 +2060,7 b' def fold(ui, repo, *files, **opts):'
2058
2060
2059 if not files:
2061 if not files:
2060 raise util.Abort(_('qfold requires at least one patch name'))
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 raise util.Abort(_('No patches applied'))
2064 raise util.Abort(_('No patches applied'))
2063 q.check_localchanges(repo)
2065 q.check_localchanges(repo)
2064
2066
@@ -2,6 +2,8 b''
2
2
3 echo "[extensions]" >> $HGRCPATH
3 echo "[extensions]" >> $HGRCPATH
4 echo "mq=" >> $HGRCPATH
4 echo "mq=" >> $HGRCPATH
5 echo "[mq]" >> $HGRCPATH
6 echo "git=keep" >> $HGRCPATH
5
7
6 echo % init
8 echo % init
7 hg init a
9 hg init a
@@ -60,3 +62,9 b' hg qdiff --nodates -w'
60
62
61 echo % qdiff --reverse
63 echo % qdiff --reverse
62 hg qdiff --nodates --reverse
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 7
103 7
104 8
104 8
105 9
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