Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 23301:c10dc5568069
context.status: wipe deleted/unknown/ignored fields when reversed
It makes no sense to request reverse status (i.e. changes from the
working copy to its parent) and then look at the deleted, unknown or
ignored fields. If you do, you would get the result from the forward
status (changes from parent to the working copy). Instead of giving a
nonsensical answer to a nonsensical question, it seems a little saner
to return empty lists. It might be best if we could prevent the caller
accessing these lists, but it's doubtful it's worth the trouble.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 12 Nov 2014 21:19:07 -0800 |
parents | 37c57a7cf160 |
children | 24f67ad49da7 |
comparison
equal
deleted
inserted
replaced
23300:f8b5c3e77d4b | 23301:c10dc5568069 |
---|---|
302 match = ctx2._matchstatus(ctx1, match) | 302 match = ctx2._matchstatus(ctx1, match) |
303 r = [[], [], [], [], [], [], []] | 303 r = [[], [], [], [], [], [], []] |
304 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean, | 304 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean, |
305 listunknown) | 305 listunknown) |
306 | 306 |
307 r = scmutil.status(*r) | |
307 if reversed: | 308 if reversed: |
308 # reverse added and removed | 309 # Reverse added and removed. Clear deleted, unknown and ignored as |
309 r[1], r[2] = r[2], r[1] | 310 # these make no sense to reverse. |
311 r = scmutil.status(r.modified, r.removed, r.added, [], [], [], | |
312 r.clean) | |
310 | 313 |
311 if listsubrepos: | 314 if listsubrepos: |
312 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): | 315 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): |
313 rev2 = ctx2.subrev(subpath) | 316 rev2 = ctx2.subrev(subpath) |
314 try: | 317 try: |
323 "subrepository: %s\n") % subpath) | 326 "subrepository: %s\n") % subpath) |
324 | 327 |
325 for l in r: | 328 for l in r: |
326 l.sort() | 329 l.sort() |
327 | 330 |
328 # we return a tuple to signify that this list isn't changing | 331 return r |
329 return scmutil.status(*r) | |
330 | 332 |
331 | 333 |
332 def makememctx(repo, parents, text, user, date, branch, files, store, | 334 def makememctx(repo, parents, text, user, date, branch, files, store, |
333 editor=None): | 335 editor=None): |
334 def getfilectx(repo, memctx, path): | 336 def getfilectx(repo, memctx, path): |