mercurial/fileset.py
branchstable
changeset 14785 0f0bd4d028d3
parent 14718 0c81948636f3
child 14830 35f5cfdd0427
equal deleted inserted replaced
14783:1688f20c95c3 14785:0f0bd4d028d3
   112 
   112 
   113 def modified(mctx, x):
   113 def modified(mctx, x):
   114     """``modified()``
   114     """``modified()``
   115     File that is modified according to status.
   115     File that is modified according to status.
   116     """
   116     """
       
   117     # i18n: "modified" is a keyword
   117     getargs(x, 0, 0, _("modified takes no arguments"))
   118     getargs(x, 0, 0, _("modified takes no arguments"))
   118     s = mctx.status()[0]
   119     s = mctx.status()[0]
   119     return [f for f in mctx.subset if f in s]
   120     return [f for f in mctx.subset if f in s]
   120 
   121 
   121 def added(mctx, x):
   122 def added(mctx, x):
   122     """``added()``
   123     """``added()``
   123     File that is added according to status.
   124     File that is added according to status.
   124     """
   125     """
       
   126     # i18n: "added" is a keyword
   125     getargs(x, 0, 0, _("added takes no arguments"))
   127     getargs(x, 0, 0, _("added takes no arguments"))
   126     s = mctx.status()[1]
   128     s = mctx.status()[1]
   127     return [f for f in mctx.subset if f in s]
   129     return [f for f in mctx.subset if f in s]
   128 
   130 
   129 def removed(mctx, x):
   131 def removed(mctx, x):
   130     """``removed()``
   132     """``removed()``
   131     File that is removed according to status.
   133     File that is removed according to status.
   132     """
   134     """
       
   135     # i18n: "removed" is a keyword
   133     getargs(x, 0, 0, _("removed takes no arguments"))
   136     getargs(x, 0, 0, _("removed takes no arguments"))
   134     s = mctx.status()[2]
   137     s = mctx.status()[2]
   135     return [f for f in mctx.subset if f in s]
   138     return [f for f in mctx.subset if f in s]
   136 
   139 
   137 def deleted(mctx, x):
   140 def deleted(mctx, x):
   138     """``deleted()``
   141     """``deleted()``
   139     File that is deleted according to status.
   142     File that is deleted according to status.
   140     """
   143     """
       
   144     # i18n: "deleted" is a keyword
   141     getargs(x, 0, 0, _("deleted takes no arguments"))
   145     getargs(x, 0, 0, _("deleted takes no arguments"))
   142     s = mctx.status()[3]
   146     s = mctx.status()[3]
   143     return [f for f in mctx.subset if f in s]
   147     return [f for f in mctx.subset if f in s]
   144 
   148 
   145 def unknown(mctx, x):
   149 def unknown(mctx, x):
   146     """``unknown()``
   150     """``unknown()``
   147     File that is unknown according to status. These files will only be
   151     File that is unknown according to status. These files will only be
   148     considered if this predicate is used.
   152     considered if this predicate is used.
   149     """
   153     """
       
   154     # i18n: "unknown" is a keyword
   150     getargs(x, 0, 0, _("unknown takes no arguments"))
   155     getargs(x, 0, 0, _("unknown takes no arguments"))
   151     s = mctx.status()[4]
   156     s = mctx.status()[4]
   152     return [f for f in mctx.subset if f in s]
   157     return [f for f in mctx.subset if f in s]
   153 
   158 
   154 def ignored(mctx, x):
   159 def ignored(mctx, x):
   155     """``ignored()``
   160     """``ignored()``
   156     File that is ignored according to status. These files will only be
   161     File that is ignored according to status. These files will only be
   157     considered if this predicate is used.
   162     considered if this predicate is used.
   158     """
   163     """
       
   164     # i18n: "ignored" is a keyword
   159     getargs(x, 0, 0, _("ignored takes no arguments"))
   165     getargs(x, 0, 0, _("ignored takes no arguments"))
   160     s = mctx.status()[5]
   166     s = mctx.status()[5]
   161     return [f for f in mctx.subset if f in s]
   167     return [f for f in mctx.subset if f in s]
   162 
   168 
   163 def clean(mctx, x):
   169 def clean(mctx, x):
   164     """``clean()``
   170     """``clean()``
   165     File that is clean according to status.
   171     File that is clean according to status.
   166     """
   172     """
       
   173     # i18n: "clean" is a keyword
   167     getargs(x, 0, 0, _("clean takes no arguments"))
   174     getargs(x, 0, 0, _("clean takes no arguments"))
   168     s = mctx.status()[6]
   175     s = mctx.status()[6]
   169     return [f for f in mctx.subset if f in s]
   176     return [f for f in mctx.subset if f in s]
   170 
   177 
   171 def func(mctx, a, b):
   178 def func(mctx, a, b):
   188 
   195 
   189 def binary(mctx, x):
   196 def binary(mctx, x):
   190     """``binary()``
   197     """``binary()``
   191     File that appears to be binary (contails NUL bytes).
   198     File that appears to be binary (contails NUL bytes).
   192     """
   199     """
       
   200     # i18n: "binary" is a keyword
   193     getargs(x, 0, 0, _("binary takes no arguments"))
   201     getargs(x, 0, 0, _("binary takes no arguments"))
   194     return [f for f in mctx.subset if util.binary(mctx.ctx[f].data())]
   202     return [f for f in mctx.subset if util.binary(mctx.ctx[f].data())]
   195 
   203 
   196 def exec_(mctx, x):
   204 def exec_(mctx, x):
   197     """``exec()``
   205     """``exec()``
   198     File that is marked as executable.
   206     File that is marked as executable.
   199     """
   207     """
       
   208     # i18n: "exec" is a keyword
   200     getargs(x, 0, 0, _("exec takes no arguments"))
   209     getargs(x, 0, 0, _("exec takes no arguments"))
   201     return [f for f in mctx.subset if mctx.ctx.flags(f) == 'x']
   210     return [f for f in mctx.subset if mctx.ctx.flags(f) == 'x']
   202 
   211 
   203 def symlink(mctx, x):
   212 def symlink(mctx, x):
   204     """``symlink()``
   213     """``symlink()``
   205     File that is marked as a symlink.
   214     File that is marked as a symlink.
   206     """
   215     """
       
   216     # i18n: "symlink" is a keyword
   207     getargs(x, 0, 0, _("symlink takes no arguments"))
   217     getargs(x, 0, 0, _("symlink takes no arguments"))
   208     return [f for f in mctx.subset if mctx.ctx.flags(f) == 'l']
   218     return [f for f in mctx.subset if mctx.ctx.flags(f) == 'l']
   209 
   219 
   210 def resolved(mctx, x):
   220 def resolved(mctx, x):
   211     """``resolved()``
   221     """``resolved()``
   212     File that is marked resolved according to the resolve state.
   222     File that is marked resolved according to the resolve state.
   213     """
   223     """
       
   224     # i18n: "resolved" is a keyword
   214     getargs(x, 0, 0, _("resolved takes no arguments"))
   225     getargs(x, 0, 0, _("resolved takes no arguments"))
   215     if mctx.ctx.rev() is not None:
   226     if mctx.ctx.rev() is not None:
   216         return []
   227         return []
   217     ms = merge.mergestate(mctx.ctx._repo)
   228     ms = merge.mergestate(mctx.ctx._repo)
   218     return [f for f in mctx.subset if f in ms and ms[f] == 'r']
   229     return [f for f in mctx.subset if f in ms and ms[f] == 'r']
   219 
   230 
   220 def unresolved(mctx, x):
   231 def unresolved(mctx, x):
   221     """``unresolved()``
   232     """``unresolved()``
   222     File that is marked unresolved according to the resolve state.
   233     File that is marked unresolved according to the resolve state.
   223     """
   234     """
       
   235     # i18n: "unresolved" is a keyword
   224     getargs(x, 0, 0, _("unresolved takes no arguments"))
   236     getargs(x, 0, 0, _("unresolved takes no arguments"))
   225     if mctx.ctx.rev() is not None:
   237     if mctx.ctx.rev() is not None:
   226         return []
   238         return []
   227     ms = merge.mergestate(mctx.ctx._repo)
   239     ms = merge.mergestate(mctx.ctx._repo)
   228     return [f for f in mctx.subset if f in ms and ms[f] == 'u']
   240     return [f for f in mctx.subset if f in ms and ms[f] == 'u']
   280     - < 20k (files less than 20480 bytes)
   292     - < 20k (files less than 20480 bytes)
   281     - >= .5MB (files at least 524288 bytes)
   293     - >= .5MB (files at least 524288 bytes)
   282     - 4k - 1MB (files from 4096 bytes to 1048576 bytes)
   294     - 4k - 1MB (files from 4096 bytes to 1048576 bytes)
   283     """
   295     """
   284 
   296 
       
   297     # i18n: "size" is a keyword
   285     expr = getstring(x, _("size requires an expression")).strip()
   298     expr = getstring(x, _("size requires an expression")).strip()
   286     if '-' in expr: # do we have a range?
   299     if '-' in expr: # do we have a range?
   287         a, b = expr.split('-', 1)
   300         a, b = expr.split('-', 1)
   288         a = _sizetoint(a)
   301         a = _sizetoint(a)
   289         b = _sizetoint(b)
   302         b = _sizetoint(b)
   314     File can be successfully decoded with the given character
   327     File can be successfully decoded with the given character
   315     encoding. May not be useful for encodings other than ASCII and
   328     encoding. May not be useful for encodings other than ASCII and
   316     UTF-8.
   329     UTF-8.
   317     """
   330     """
   318 
   331 
       
   332     # i18n: "encoding" is a keyword
   319     enc = getstring(x, _("encoding requires an encoding name"))
   333     enc = getstring(x, _("encoding requires an encoding name"))
   320 
   334 
   321     s = []
   335     s = []
   322     for f in mctx.subset:
   336     for f in mctx.subset:
   323         d = mctx.ctx[f].data()
   337         d = mctx.ctx[f].data()
   333 
   347 
   334 def copied(mctx, x):
   348 def copied(mctx, x):
   335     """``copied()``
   349     """``copied()``
   336     File that is recorded as being copied.
   350     File that is recorded as being copied.
   337     """
   351     """
       
   352     # i18n: "copied" is a keyword
   338     getargs(x, 0, 0, _("copied takes no arguments"))
   353     getargs(x, 0, 0, _("copied takes no arguments"))
   339     s = []
   354     s = []
   340     for f in mctx.subset:
   355     for f in mctx.subset:
   341         p = mctx.ctx[f].parents()
   356         p = mctx.ctx[f].parents()
   342         if p and p[0].path() != f:
   357         if p and p[0].path() != f: