Patchwork [1,of,8] filectx: add a repo accessor

login
register
mail settings
Submitter Matt Harbison
Date March 14, 2015, 1:28 a.m.
Message ID <0467e262cc72c4c9037e.1426296512@Envy>
Download mbox | patch
Permalink /patch/8082/
State Accepted
Commit 5da0eb641881c5a1832e9f1635d2ac62581fbf90
Headers show

Comments

Matt Harbison - March 14, 2015, 1:28 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1426293292 14400
#      Fri Mar 13 20:34:52 2015 -0400
# Node ID 0467e262cc72c4c9037ef2ddcf4c51f89c367fea
# Parent  15afda349b11b531edd1ea6ec02847e01fe35615
filectx: add a repo accessor

This is similar to a07314472a80 in motivation.  All contexts now have this
method, so the rest of the 'ctx._repo' uses can be converted without worrying
about what type of context it is.
Ryan McElroy - March 14, 2015, 7:41 a.m.
On 3/13/2015 6:28 PM, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1426293292 14400
> #      Fri Mar 13 20:34:52 2015 -0400
> # Node ID 0467e262cc72c4c9037ef2ddcf4c51f89c367fea
> # Parent  15afda349b11b531edd1ea6ec02847e01fe35615
> filectx: add a repo accessor
>
> This is similar to a07314472a80 in motivation.  All contexts now have this
> method, so the rest of the 'ctx._repo' uses can be converted without worrying
> about what type of context it is.
>
> <snip>

This series looks well-structured and is a nice incremental improvement. 
ryanmce-approved!

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -725,6 +725,8 @@ 
         return self._changectx.manifest()
     def changectx(self):
         return self._changectx
+    def repo(self):
+        return self._repo
 
     def path(self):
         return self._path