Show More
@@ -202,17 +202,28 b' def writediffproperties(ctx, diff):' | |||
|
202 | 202 | } |
|
203 | 203 | callconduit(ctx.repo(), 'differential.setdiffproperty', params) |
|
204 | 204 | |
|
205 | def createdifferentialrevision(ctx, revid=None, parentrevid=None): | |
|
205 | def createdifferentialrevision(ctx, revid=None, parentrevid=None, oldnode=None): | |
|
206 | 206 | """create or update a Differential Revision |
|
207 | 207 | |
|
208 | 208 | If revid is None, create a new Differential Revision, otherwise update |
|
209 | 209 | revid. If parentrevid is not None, set it as a dependency. |
|
210 | ||
|
211 | If oldnode is not None, check if the patch content (without commit message | |
|
212 | and metadata) has changed before creating another diff. | |
|
210 | 213 | """ |
|
211 | 214 | repo = ctx.repo() |
|
212 | diff = creatediff(ctx) | |
|
213 | writediffproperties(ctx, diff) | |
|
215 | if oldnode: | |
|
216 | diffopts = mdiff.diffopts(git=True, context=1) | |
|
217 | oldctx = repo.unfiltered()[oldnode] | |
|
218 | neednewdiff = (getdiff(ctx, diffopts) != getdiff(oldctx, diffopts)) | |
|
219 | else: | |
|
220 | neednewdiff = True | |
|
214 | 221 | |
|
215 | transactions = [{'type': 'update', 'value': diff[r'phid']}] | |
|
222 | transactions = [] | |
|
223 | if neednewdiff: | |
|
224 | diff = creatediff(ctx) | |
|
225 | writediffproperties(ctx, diff) | |
|
226 | transactions.append({'type': 'update', 'value': diff[r'phid']}) | |
|
216 | 227 | |
|
217 | 228 | # Use a temporary summary to set dependency. There might be better ways but |
|
218 | 229 | # I cannot find them for now. But do not do that if we are updating an |
@@ -271,7 +282,8 b' def phabsend(ui, repo, *revs, **opts):' | |||
|
271 | 282 | oldnode, revid = getmapping(ctx) |
|
272 | 283 | if oldnode != ctx.node(): |
|
273 | 284 | # Create or update Differential Revision |
|
274 |
revision = createdifferentialrevision(ctx, revid, lastrevid |
|
|
285 | revision = createdifferentialrevision(ctx, revid, lastrevid, | |
|
286 | oldnode) | |
|
275 | 287 | newrevid = int(revision[r'object'][r'id']) |
|
276 | 288 | if revid: |
|
277 | 289 | action = _('updated') |
General Comments 0
You need to be logged in to leave comments.
Login now