当前位置: 首页>>代码示例>>PHP>>正文


PHP FileList::contains方法代码示例

本文整理汇总了PHP中FileList::contains方法的典型用法代码示例。如果您正苦于以下问题:PHP FileList::contains方法的具体用法?PHP FileList::contains怎么用?PHP FileList::contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileList的用法示例。


在下文中一共展示了FileList::contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateAffectedPaths

 private function generateAffectedPaths()
 {
     if ($this->isRawDiffSource()) {
         return array();
     }
     $repository_api = $this->getRepositoryAPI();
     if ($repository_api instanceof ArcanistSubversionAPI) {
         $file_list = new FileList($this->getArgument('paths', array()));
         $paths = $repository_api->getSVNStatus($externals = true);
         foreach ($paths as $path => $mask) {
             if (!$file_list->contains($repository_api->getPath($path), true)) {
                 unset($paths[$path]);
             }
         }
         $warn_externals = array();
         foreach ($paths as $path => $mask) {
             $any_mod = $mask & ArcanistRepositoryAPI::FLAG_ADDED || $mask & ArcanistRepositoryAPI::FLAG_MODIFIED || $mask & ArcanistRepositoryAPI::FLAG_DELETED;
             if ($mask & ArcanistRepositoryAPI::FLAG_EXTERNALS) {
                 unset($paths[$path]);
                 if ($any_mod) {
                     $warn_externals[] = $path;
                 }
             }
         }
         if ($warn_externals && !$this->hasWarnedExternals) {
             echo phutil_console_format("%s\n\n%s\n\n", pht("The working copy includes changes to '%s' paths. These " . "changes will not be included in the diff because SVN can not " . "commit 'svn:externals' changes alongside normal changes.", 'svn:externals'), pht("Modified '%s' files:", 'svn:externals'), phutil_console_wrap(implode("\n", $warn_externals), 8));
             $prompt = pht('Generate a diff (with just local changes) anyway?');
             if (!phutil_console_confirm($prompt)) {
                 throw new ArcanistUserAbortException();
             } else {
                 $this->hasWarnedExternals = true;
             }
         }
     } else {
         $paths = $repository_api->getWorkingCopyStatus();
     }
     foreach ($paths as $path => $mask) {
         if ($mask & ArcanistRepositoryAPI::FLAG_UNTRACKED) {
             unset($paths[$path]);
         }
     }
     return $paths;
 }
开发者ID:rmaz,项目名称:arcanist,代码行数:43,代码来源:ArcanistDiffWorkflow.php

示例2: isDescendant

 /**
  * Test whether a path is descendant from some root path after resolving all
  * symlinks and removing artifacts. Both paths must exists for the relation
  * to obtain. A path is always a descendant of itself as long as it exists.
  *
  * @param  string   Child path, absolute or relative to PWD.
  * @param  string   Root path, absolute or relative to PWD.
  * @return bool     True if resolved child path is in fact a descendant of
  *                  resolved root path and both exist.
  * @task   path
  */
 public static function isDescendant($path, $root)
 {
     try {
         self::assertExists($path);
         self::assertExists($root);
     } catch (FilesystemException $e) {
         return false;
     }
     $fs = new FileList(array($root));
     return $fs->contains($path);
 }
开发者ID:barcelonascience,项目名称:libphutil,代码行数:22,代码来源:Filesystem.php


注:本文中的FileList::contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。