Patchwork [41,of,48,RFC] commitablectx: move ancestors from workingctx

login
register
mail settings
Submitter Sean Farley
Date Sept. 5, 2013, 8:07 p.m.
Message ID <a4bead02a7e17acb828b.1378411655@laptop.local>
Download mbox | patch
Permalink /patch/2379/
State Accepted
Commit 8d4a8f4eb40412faeb2dfc76a82da491fcc0fe9f
Headers show

Comments

Sean Farley - Sept. 5, 2013, 8:07 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1376516279 18000
#      Wed Aug 14 16:37:59 2013 -0500
# Node ID a4bead02a7e17acb828bd9f5fb7f3439efd21417
# Parent  ba605dc891b76aba6b94fa877ddf5075b438f0fe
commitablectx: move ancestors from workingctx

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1036,10 +1036,15 @@ 
 
     def walk(self, match):
         return sorted(self._repo.dirstate.walk(match, sorted(self.substate),
                                                True, False))
 
+    def ancestors(self):
+        for a in self._repo.changelog.ancestors(
+            [p.rev() for p in self._parents]):
+            yield changectx(self._repo, a)
+
 class workingctx(commitablectx):
     """A workingctx object makes access to data related to
     the current working directory convenient.
     date - any valid date string or (unixtime, offset), or None.
     user - username string, or None.
@@ -1131,15 +1136,10 @@ 
                     self._repo.dirstate.drop(f)
             return rejected
         finally:
             wlock.release()
 
-    def ancestors(self):
-        for a in self._repo.changelog.ancestors(
-            [p.rev() for p in self._parents]):
-            yield changectx(self._repo, a)
-
     def undelete(self, list):
         pctxs = self.parents()
         wlock = self._repo.wlock()
         try:
             for f in list: