D6367: context: add ctx.files{modified,added,removed}() methods

2019-05-25 Thread martinvonz (Martin von Zweigbergk)
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=15264#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6367?vs=15151=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
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6367: context: add ctx.files{modified,added,removed}() methods

2019-05-16 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 15151.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6367?vs=15079=15151

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.added())
+modified.difference_update(self.removed())
+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
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6367: context: add ctx.files{modified,added,removed}() methods

2019-05-14 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 15079.
martinvonz retitled this revision from "context: add modified(), added(), 
removed() to changectx too" to "context: add 
ctx.files{modified,added,removed}() methods".
martinvonz edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6367?vs=15061=15079

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.added())
+modified.difference_update(self.removed())
+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')
@@ -1176,6 +1194,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
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel