Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 21616:0a8e7f81e8ae
context: explicitly return a tuple
In the refactoring of removing localrepo.status, 2edb8648c500, we accidentally
changed the return type from a tuple to a list. Philosophically, this is
incorrect so we explicitly return a tuple again.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Tue, 27 May 2014 17:04:48 -0500 |
parents | aca692aa0712 |
children | 8d9449eaaeff |
comparison
equal
deleted
inserted
replaced
21614:609a642dff61 | 21616:0a8e7f81e8ae |
---|---|
324 self._repo.ui.status(_("skipping missing " | 324 self._repo.ui.status(_("skipping missing " |
325 "subrepository: %s\n") % subpath) | 325 "subrepository: %s\n") % subpath) |
326 | 326 |
327 for l in r: | 327 for l in r: |
328 l.sort() | 328 l.sort() |
329 return r | 329 |
330 # we return a tuple to signify that this list isn't changing | |
331 return tuple(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): |
1444 # 'memctx'? | 1446 # 'memctx'? |
1445 s = super(workingctx, self).status(other, match, listignored, listclean, | 1447 s = super(workingctx, self).status(other, match, listignored, listclean, |
1446 listunknown, listsubrepos) | 1448 listunknown, listsubrepos) |
1447 # calling 'super' subtly reveresed the contexts, so we flip the results | 1449 # calling 'super' subtly reveresed the contexts, so we flip the results |
1448 # (s[1] is 'added' and s[2] is 'removed') | 1450 # (s[1] is 'added' and s[2] is 'removed') |
1451 s = list(s) | |
1449 s[1], s[2] = s[2], s[1] | 1452 s[1], s[2] = s[2], s[1] |
1450 return s | 1453 return tuple(s) |
1451 | 1454 |
1452 class committablefilectx(basefilectx): | 1455 class committablefilectx(basefilectx): |
1453 """A committablefilectx provides common functionality for a file context | 1456 """A committablefilectx provides common functionality for a file context |
1454 that wants the ability to commit, e.g. workingfilectx or memfilectx.""" | 1457 that wants the ability to commit, e.g. workingfilectx or memfilectx.""" |
1455 def __init__(self, repo, path, filelog=None, ctx=None): | 1458 def __init__(self, repo, path, filelog=None, ctx=None): |