Patchwork [4,of,5] manifest: add hasdir() to context

login
register
mail settings
Submitter Drew Gottlieb
Date March 13, 2015, 11:35 p.m.
Message ID <e6322f7d1ebdd7f67d06.1426289736@waste.org>
Download mbox | patch
Permalink /patch/8075/
State Accepted
Commit 79d9c51488ca2fb11384331f48de1986ee89a87b
Headers show

Comments

Drew Gottlieb - March 13, 2015, 11:35 p.m.
# HG changeset patch
# User Drew Gottlieb <drgott@google.com>
# Date 1426285965 25200
#      Fri Mar 13 15:32:45 2015 -0700
# Node ID e6322f7d1ebdd7f67d0656bad2eacbd7d76547e5
# Parent  ef68db445223246132b8d0b8609e131b1ee2065d
manifest: add hasdir() to context

This is a convenience method that calls to its manifest's hasdir(). There are
parts of context that check to see if a directory exists, and this method will
let implementations of manifest provide an optimal way to find a particular
directory.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -269,6 +269,8 @@ 
     def dirs(self):
         return self._manifest.dirs()
 
+    def hasdir(self, dir):
+        return self._manifest.hasdir(dir)
 
     def dirty(self, missing=False, merge=True, branch=True):
         return False