Patchwork [1,of,6] basefilectx: move isexec and islink from memfilectx

login
register
mail settings
Submitter Sean Farley
Date Aug. 6, 2014, 8:42 p.m.
Message ID <7770641d319fa262b78e.1407357727@178.1.168.192.in-addr.arpa>
Download mbox | patch
Permalink /patch/5295/
State Accepted
Headers show

Comments

Sean Farley - Aug. 6, 2014, 8:42 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1406337107 18000
#      Fri Jul 25 20:11:47 2014 -0500
# Node ID 7770641d319fa262b78efb8b3fb470f336997561
# Parent  4354b1e35f533f72d5b6ccc76e8bc742f8cb5257
basefilectx: move isexec and islink from memfilectx

This will be used in the future for creating memctx objects from other
store-type objects, such as a patch store or even another context.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -712,10 +712,14 @@  class basefilectx(object):
     def isbinary(self):
         try:
             return util.binary(self.data())
         except IOError:
             return False
+    def isexec(self):
+        return 'x' in self.flags()
+    def islink(self):
+        return 'l' in self.flags()
 
     def cmp(self, fctx):
         """compare with other file context
 
         returns True if different than fctx.
@@ -1654,11 +1658,7 @@  class memfilectx(committablefilectx):
         return self._data
     def size(self):
         return len(self.data())
     def flags(self):
         return self._flags
-    def isexec(self):
-        return 'x' in self._flags
-    def islink(self):
-        return 'l' in self._flags
     def renamed(self):
         return self._copied