D6367: context: add ctx.files{modified,added,removed}() methods
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Sat May 25 18:54:34 EDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG65fa61ca20af: context: add ctx.files{modified,added,removed}() methods (authored by martinvonz, committed by ).
CHANGED PRIOR TO COMMIT
https://phab.mercurial-scm.org/D6367?vs=15151&id=15264#toc
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D6367?vs=15151&id=15264
REVISION DETAIL
https://phab.mercurial-scm.org/D6367
AFFECTED FILES
mercurial/context.py
CHANGE DETAILS
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -463,6 +463,24 @@
return self._changeset.date
def files(self):
return self._changeset.files
+ def filesmodified(self):
+ modified = set(self.files())
+ modified.difference_update(self.filesadded())
+ modified.difference_update(self.filesremoved())
+ return sorted(modified)
+ def filesadded(self):
+ added = []
+ for f in self.files():
+ if not any(f in p for p in self.parents()):
+ added.append(f)
+ return added
+ def filesremoved(self):
+ removed = []
+ for f in self.files():
+ if f not in self:
+ removed.append(f)
+ return removed
+
@propertycache
def _copies(self):
source = self._repo.ui.config('experimental', 'copies.read-from')
@@ -1170,6 +1188,10 @@
return self._status.removed
def deleted(self):
return self._status.deleted
+ filesmodified = modified
+ filesadded = added
+ filesremoved = removed
+
def branch(self):
return encoding.tolocal(self._extra['branch'])
def closesbranch(self):
To: martinvonz, #hg-reviewers, pulkit
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list