##// END OF EJS Templates
context: override _dirstatestatus in workingcommitctx for correct matching...
FUJIWARA Katsunori -
r23712:bfce25d2 default
parent child Browse files
Show More
@@ -1646,6 +1646,32 b' class workingcommitctx(workingctx):'
1646 listignored, listclean, listunknown)
1646 listignored, listclean, listunknown)
1647 return s
1647 return s
1648
1648
1649 def _dirstatestatus(self, match=None, ignored=False, clean=False,
1650 unknown=False):
1651 """Return matched files only in ``self._status``
1652
1653 Uncommitted files appear "clean" via this context, even if
1654 they aren't actually so in the working directory.
1655 """
1656 match = match or matchmod.always(self._repo.root, self._repo.getcwd())
1657 if clean:
1658 clean = [f for f in self._manifest if f not in self._changedset]
1659 else:
1660 clean = []
1661 return scmutil.status([f for f in self._status.modified if match(f)],
1662 [f for f in self._status.added if match(f)],
1663 [f for f in self._status.removed if match(f)],
1664 [], [], [], clean)
1665
1666 @propertycache
1667 def _changedset(self):
1668 """Return the set of files changed in this context
1669 """
1670 changed = set(self._status.modified)
1671 changed.update(self._status.added)
1672 changed.update(self._status.removed)
1673 return changed
1674
1649 class memctx(committablectx):
1675 class memctx(committablectx):
1650 """Use memctx to perform in-memory commits via localrepo.commitctx().
1676 """Use memctx to perform in-memory commits via localrepo.commitctx().
1651
1677
@@ -434,7 +434,7 b' specific template keywords work well'
434 > changeset = {desc}
434 > changeset = {desc}
435 > HG: files={files}
435 > HG: files={files}
436 > HG:
436 > HG:
437 > {splitlines(diff()) % ''
437 > {splitlines(diff()) % 'HG: {line}\n'
438 > }HG:
438 > }HG:
439 > HG: files={files}\n
439 > HG: files={files}\n
440 > EOF
440 > EOF
@@ -446,6 +446,11 b' specific template keywords work well'
446 foo bar
446 foo bar
447 HG: files=changed
447 HG: files=changed
448 HG:
448 HG:
449 HG: --- a/changed Thu Jan 01 00:00:00 1970 +0000
450 HG: +++ b/changed Thu Jan 01 00:00:00 1970 +0000
451 HG: @@ -1,1 +1,2 @@
452 HG: changed
453 HG: +changed
449 HG:
454 HG:
450 HG: files=changed
455 HG: files=changed
451 $ hg status -amr
456 $ hg status -amr
@@ -458,6 +463,51 b' specific template keywords work well'
458 $ hg rollback -q
463 $ hg rollback -q
459
464
460 $ cat >> .hg/hgrc <<EOF
465 $ cat >> .hg/hgrc <<EOF
466 > [committemplate]
467 > changeset = {desc}
468 > HG: files={files}
469 > HG:
470 > {splitlines(diff("changed")) % 'HG: {line}\n'
471 > }HG:
472 > HG: files={files}
473 > HG:
474 > {splitlines(diff("added")) % 'HG: {line}\n'
475 > }HG:
476 > HG: files={files}
477 > HG:
478 > {splitlines(diff("removed")) % 'HG: {line}\n'
479 > }HG:
480 > HG: files={files}\n
481 > EOF
482 $ HGEDITOR=cat hg commit -q -e -m "foo bar" added removed
483 foo bar
484 HG: files=added removed
485 HG:
486 HG:
487 HG: files=added removed
488 HG:
489 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
490 HG: +++ b/added Thu Jan 01 00:00:00 1970 +0000
491 HG: @@ -0,0 +1,1 @@
492 HG: +added
493 HG:
494 HG: files=added removed
495 HG:
496 HG: --- a/removed Thu Jan 01 00:00:00 1970 +0000
497 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
498 HG: @@ -1,1 +0,0 @@
499 HG: -removed
500 HG:
501 HG: files=added removed
502 $ hg status -amr
503 M changed
504 $ hg parents --template "M {file_mods}\nA {file_adds}\nR {file_dels}\n"
505 M
506 A added
507 R removed
508 $ hg rollback -q
509
510 $ cat >> .hg/hgrc <<EOF
461 > # disable customizing for subsequent tests
511 > # disable customizing for subsequent tests
462 > [committemplate]
512 > [committemplate]
463 > changeset =
513 > changeset =
@@ -108,13 +108,31 b' wcctx = context.workingcommitctx(repo,'
108 print 'wcctx._status=%s' % (str(wcctx._status))
108 print 'wcctx._status=%s' % (str(wcctx._status))
109
109
110 print '=== with "always match":'
110 print '=== with "always match":'
111 actx1.status(other=wcctx)
111 print actx1.status(other=wcctx)
112 print 'wcctx._status=%s' % (str(wcctx._status))
112 print 'wcctx._status=%s' % (str(wcctx._status))
113 actx2.status(other=wcctx)
113 print actx2.status(other=wcctx)
114 print 'wcctx._status=%s' % (str(wcctx._status))
114 print 'wcctx._status=%s' % (str(wcctx._status))
115
115
116 print '=== with "always match" and "listclean=True":'
116 print '=== with "always match" and "listclean=True":'
117 actx1.status(other=wcctx, listclean=True)
117 print actx1.status(other=wcctx, listclean=True)
118 print 'wcctx._status=%s' % (str(wcctx._status))
119 print actx2.status(other=wcctx, listclean=True)
120 print 'wcctx._status=%s' % (str(wcctx._status))
121
122 print '=== with "pattern match":'
123 print actx1.status(other=wcctx,
124 match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
118 print 'wcctx._status=%s' % (str(wcctx._status))
125 print 'wcctx._status=%s' % (str(wcctx._status))
119 actx2.status(other=wcctx, listclean=True)
126 print actx2.status(other=wcctx,
127 match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
120 print 'wcctx._status=%s' % (str(wcctx._status))
128 print 'wcctx._status=%s' % (str(wcctx._status))
129
130 print '=== with "pattern match" and "listclean=True":'
131 print actx1.status(other=wcctx,
132 match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
133 listclean=True)
134 print 'wcctx._status=%s' % (str(wcctx._status))
135 print actx2.status(other=wcctx,
136 match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
137 listclean=True)
138 print 'wcctx._status=%s' % (str(wcctx._status))
@@ -27,8 +27,22 b" wctx._status=<status modified=['bar-m'],"
27 == checking workingcommitctx.status:
27 == checking workingcommitctx.status:
28 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
28 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
29 === with "always match":
29 === with "always match":
30 <status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
30 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
31 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
32 <status modified=[], added=['bar-a', 'bar-m', 'bar-r'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
31 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
33 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
32 === with "always match" and "listclean=True":
34 === with "always match" and "listclean=True":
35 <status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=['bar-r', 'foo']>
33 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
36 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
37 <status modified=[], added=['bar-a', 'bar-m', 'bar-r'], removed=[], deleted=[], unknown=[], ignored=[], clean=['foo']>
34 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
38 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
39 === with "pattern match":
40 <status modified=['bar-m'], added=[], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
41 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
42 <status modified=[], added=['bar-m'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
43 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
44 === with "pattern match" and "listclean=True":
45 <status modified=[], added=[], removed=[], deleted=[], unknown=[], ignored=[], clean=['bar-r', 'foo']>
46 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
47 <status modified=[], added=['bar-r'], removed=[], deleted=[], unknown=[], ignored=[], clean=['foo']>
48 wcctx._status=<status modified=['bar-m'], added=['bar-a'], removed=[], deleted=[], unknown=[], ignored=[], clean=[]>
General Comments 0
You need to be logged in to leave comments. Login now