Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Mercurial(hg)中列出存储库中的所有文件?_Mercurial_Hgignore - Fatal编程技术网

如何在Mercurial(hg)中列出存储库中的所有文件?

如何在Mercurial(hg)中列出存储库中的所有文件?,mercurial,hgignore,Mercurial,Hgignore,mercurial中是否有一个命令可以列出当前受源代码管理的所有文件 我可以使用dir/s列出文件夹和子文件夹中的所有文件,但我不知道哪些文件已添加到我的存储库中。我有各种被排除的文件类型和文件夹,我希望在将它们设置到.hgignore文件中之前验证它们是否已添加。hg manifest将仅列出存储库中的文件,而hg status--all将列出存储库结构中的所有文件,并包括一个正在跟踪和未跟踪的标记。hg status--all将列出树中的所有文件,并用一个字母指示其状态:M表示已修改,C表示

mercurial中是否有一个命令可以列出当前受源代码管理的所有文件


我可以使用
dir/s
列出文件夹和子文件夹中的所有文件,但我不知道哪些文件已添加到我的存储库中。我有各种被排除的文件类型和文件夹,我希望在将它们设置到.hgignore文件中之前验证它们是否已添加。

hg manifest
将仅列出存储库中的文件,而
hg status--all
将列出存储库结构中的所有文件,并包括一个正在跟踪和未跟踪的标记。

hg status--all
将列出树中的所有文件,并用一个字母指示其状态:M表示已修改,C表示已清除(归hg所有),I表示已忽略

对于仅被忽略的文件,请使用
hg status-i
。对于下一次提交时将添加的文件,请使用
hg status-a
。这些只显示您需要知道的内容,不需要扫描一个长的文件列表

C:\>hg help -v status hg status [OPTION]... [FILE]... aliases: st show changed files in the working directory Show status of files in the repository. If names are given, only files that match are shown. Files that are clean or ignored or the source of a copy/move operation, are not listed unless -c/--clean, -i/--ignored, -C/--copies or -A/--all are given. Unless options described with "show only ..." are given, the options -mardu are used. Option -q/--quiet hides untracked (unknown and ignored) files unless explicitly requested with -u/--unknown or -i/--ignored. NOTE: status may appear to disagree with diff if permissions have changed or a merge has occurred. The standard diff format does not report permission changes and diff only reports changes relative to one merge parent. If one revision is given, it is used as the base revision. If two revisions are given, the differences between them are shown. The --change option can also be used as a shortcut to list the changed files of a revision from its first parent. The codes used to show the status of files are: M = modified A = added R = removed C = clean ! = missing (deleted by non-hg command, but still tracked) ? = not tracked I = ignored = origin of the previous file listed as A (added) options: -A --all show status of all files -m --modified show only modified files -a --added show only added files -r --removed show only removed files -d --deleted show only deleted (but tracked) files -c --clean show only files without changes -u --unknown show only unknown (not tracked) files -i --ignored show only ignored files -n --no-status hide status prefix -C --copies show source of copied files -0 --print0 end filenames with NUL, for use with xargs --rev show difference from revision --change list the changed files of a revision -I --include include names matching the given patterns -X --exclude exclude names matching the given patterns global options: -R --repository repository root directory or name of overlay bundle file --cwd change working directory -y --noninteractive do not prompt, assume 'yes' for any required answers -q --quiet suppress output -v --verbose enable additional output --config set/override config option (use 'section.name=value') --debug enable debugging output --debugger start debugger --encoding set the charset encoding (default: cp1252) --encodingmode set the charset encoding mode (default: strict) --traceback always print a traceback on exception --time time how long the command takes --profile print command execution profile --version output version information and exit -h --help display help and exit C:\>hg帮助-v状态 hg状态[选项]。。。[文件]。。。 别名:st 在工作目录中显示更改的文件 显示存储库中文件的状态。如果指定了名称,则仅显示文件 这场比赛正在进行中。清除或忽略的文件,或 复制/移动操作,除非忽略-c/--clean,-i/--, -C/--副本或-A/--均已给出。除非“显示”中描述的选项 只给出了…,使用选项-mardu。 选项-q/--quiet隐藏未跟踪(未知和忽略)的文件,除非 用-u/--未知或-i/--忽略显式请求。 注意:如果权限已更改,状态可能与diff不一致 或者发生了合并。标准差异格式不报告 权限更改和差异仅报告与一个合并相关的更改 父母亲 如果给出了一个修订,则将其用作基础修订。如果两个 给出了修订,显示了它们之间的差异。变化 选项还可以用作快捷方式,以列出已更改的文件 从其第一个父级进行修订。 用于显示文件状态的代码为: M=修改 A=已添加 R=移除 C=清洁 ! = 缺失(由非hg命令删除,但仍被跟踪) ? = 未跟踪 I=忽略 =列为A的上一个文件的来源(已添加) 选项: -A—全部显示所有文件的状态 -m—已修改仅显示已修改的文件 -a--添加的仅显示添加的文件 -r—已删除仅显示已删除的文件 -d—已删除仅显示已删除(但已跟踪)的文件 -c—只显示文件而不进行更改 -u—未知仅显示未知(未跟踪)文件 -i—忽略仅显示忽略的文件 -n—无状态隐藏状态前缀 -C—副本显示复制文件的来源 -0—使用NUL打印0个结束文件名,用于xargs --版次显示与版次的差异 --更改列表修订的更改文件 -I——包含与给定模式匹配的名称 -X—排除与给定模式匹配的名称 全球选择: -R—存储库根目录或覆盖包文件的名称 --更改工作目录 -y——非交互不提示,假设任何所需答案为“是” -q——静音抑制输出 -v—详细启用附加输出 --配置设置/覆盖配置选项(使用'section.name=value') --调试启用调试输出 --调试器启动调试器 --编码设置字符集编码(默认值:cp1252) --encodingmode设置字符集编码模式(默认值:strict) --回溯始终在异常时打印回溯 --这个命令需要多长时间 --配置文件打印命令执行配置文件 --版本输出版本信息并退出 -h—帮助显示帮助并退出
您还可以查看
hg locate
命令。当我想将文件限制到某个目录时,我会使用它和
-I
选项

要列出存储库中的所有文件,请执行以下操作:

hg locate
从存储库(“根”)目录:

hg locate -I dir/sub_dir/dir_of_interest
传递到
-I
的路径需要根据运行命令的目录进行更改。如果从上例中的
dir
目录运行该命令,则需要修改参数以查找:

hg locate -I sub_dir/dir_of_interest
输出文件列表将保持不变,显示存储库中每个文件的完整路径

有关详细信息,请尝试
hg help-v locate

仅列出被忽略或添加的文件 要仅列出被忽略的文件,请执行:
hg status-i

对于刚刚添加的文件,请执行
hg status-a

如果你不太喜欢打字,你可以把它们缩短为
hgsta-i
hgsta-a

status
的这两种用法比
locate
更简单,可以为您提供您所关心的特定文件状态,因此更不容易出错

更多关于hg状态的信息 要在mercurial repo中列出所有文件,请执行以下操作:
hg status--all

列出这些文件时,将在其前面指定一个前缀:

  M = modified
  A = added
  R = removed
  C = clean
  ! = missing (deleted by non-hg command, but still tracked)
  ? = not tracked
  I = ignored
如果只想列出文件夹中的文件,可以提供路径:

  • hg st--all MyFolder
    –MyFolder中的所有文件
  • hg sta-i MyFolder
    –只是忽略了MyFolder中的文件
除了表示“已忽略”的
-i
和表示“已添加”的
-a
,还可以使用其他标志来仅列出具有特定状态的文件

获取
帮助
读一本综合读物
hg help status