Patchwork [01,of,12] basectx: add subrev method to return the rev of a subrepo given a subpath

login
register
mail settings
Submitter Sean Farley
Date May 19, 2014, 8:32 p.m.
Message ID <53d8ca434b345d7a3d6a.1400531528@laptop.local>
Download mbox | patch
Permalink /patch/4803/
State Accepted
Commit 8a2637cf1130313c3113673057f81b0687f3601b
Headers show

Comments

Sean Farley - May 19, 2014, 8:32 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1379732142 18000
#      Fri Sep 20 21:55:42 2013 -0500
# Node ID 53d8ca434b345d7a3d6aa2ed82131f64ad5f2e0b
# Parent  63c3014d89ccc998da6fca896304c0f098da6eb6
basectx: add subrev method to return the rev of a subrepo given a subpath

This will be used in an upcoming patch to simplify the status method by
eliminating an if block.
Pierre-Yves David - May 27, 2014, 11:05 p.m.
On 05/19/2014 01:32 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1379732142 18000
> #      Fri Sep 20 21:55:42 2013 -0500
> # Node ID 53d8ca434b345d7a3d6aa2ed82131f64ad5f2e0b
> # Parent  63c3014d89ccc998da6fca896304c0f098da6eb6
> basectx: add subrev method to return the rev of a subrepo given a subpath

A version of this series that actually pass test have been pushed to the 
clowncopter. Kudos!

I would be happy to see the next series now.

(queued)

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -130,10 +130,13 @@  class basectx(object):
 
     @propertycache
     def substate(self):
         return subrepo.state(self, self._repo.ui)
 
+    def subrev(self, subpath):
+        return self.substate[subpath][1]
+
     def rev(self):
         return self._rev
     def node(self):
         return self._node
     def hex(self):