Mercurial > hg
comparison mercurial/context.py @ 23304:dd3f857598a0
context.status: pass status tuple into _buildstatus
By passing a status tuple (instead of the current list), we can access
the status fields by name and make it a little more readable.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 12 Nov 2014 22:20:36 -0800 |
parents | 3f269bd4826c |
children | 0cc283f44655 |
comparison
equal
deleted
inserted
replaced
23303:3f269bd4826c | 23304:dd3f857598a0 |
---|---|
106 self.manifest() | 106 self.manifest() |
107 mf1 = other._manifestmatches(match, s) | 107 mf1 = other._manifestmatches(match, s) |
108 mf2 = self._manifestmatches(match, s) | 108 mf2 = self._manifestmatches(match, s) |
109 | 109 |
110 modified, added, clean = [], [], [] | 110 modified, added, clean = [], [], [] |
111 deleted, unknown, ignored = s[3], s[4], s[5] | 111 deleted, unknown, ignored = s.deleted, s.unknown, s.ignored |
112 deletedset = set(deleted) | 112 deletedset = set(deleted) |
113 withflags = mf1.withflags() | mf2.withflags() | 113 withflags = mf1.withflags() | mf2.withflags() |
114 for fn, mf2node in mf2.iteritems(): | 114 for fn, mf2node in mf2.iteritems(): |
115 if fn in mf1: | 115 if fn in mf1: |
116 if (fn not in deletedset and | 116 if (fn not in deletedset and |
299 and isinstance(ctx2, changectx)): | 299 and isinstance(ctx2, changectx)): |
300 reversed = True | 300 reversed = True |
301 ctx1, ctx2 = ctx2, ctx1 | 301 ctx1, ctx2 = ctx2, ctx1 |
302 | 302 |
303 match = ctx2._matchstatus(ctx1, match) | 303 match = ctx2._matchstatus(ctx1, match) |
304 r = [[], [], [], [], [], [], []] | 304 r = scmutil.status([], [], [], [], [], [], []) |
305 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean, | 305 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean, |
306 listunknown) | 306 listunknown) |
307 | 307 |
308 if reversed: | 308 if reversed: |
309 # Reverse added and removed. Clear deleted, unknown and ignored as | 309 # Reverse added and removed. Clear deleted, unknown and ignored as |
1387 The fast path is when we compare the working directory to its parent | 1387 The fast path is when we compare the working directory to its parent |
1388 which means this function is comparing with a non-parent; therefore we | 1388 which means this function is comparing with a non-parent; therefore we |
1389 need to build a manifest and return what matches. | 1389 need to build a manifest and return what matches. |
1390 """ | 1390 """ |
1391 mf = self._repo['.']._manifestmatches(match, s) | 1391 mf = self._repo['.']._manifestmatches(match, s) |
1392 modified, added, removed = s[0:3] | 1392 for f in s.modified + s.added: |
1393 for f in modified + added: | |
1394 mf[f] = None | 1393 mf[f] = None |
1395 mf.setflag(f, self.flags(f)) | 1394 mf.setflag(f, self.flags(f)) |
1396 for f in removed: | 1395 for f in s.removed: |
1397 if f in mf: | 1396 if f in mf: |
1398 del mf[f] | 1397 del mf[f] |
1399 return mf | 1398 return mf |
1400 | 1399 |
1401 def _dirstatestatus(self, match=None, ignored=False, clean=False, | 1400 def _dirstatestatus(self, match=None, ignored=False, clean=False, |