How to list all files in a repository in Mercurial (hg)?

后端 未结 5 685
小蘑菇
小蘑菇 2021-01-30 19:19

Is there a command in mercurial that will list all files currently under source control?

I can do a dir /s to list all files in my folder and subfolders,

5条回答
  •  情歌与酒
    2021-01-30 20:13

    Listing Only Ignored Or Added Files

    To list only the ignored files, do: hg status -i.

    For just added files, do hg status -a.

    If you don't like typing much, you can shorten these to hg sta -i and hg sta -a.

    This two uses of status are more simple than locate and will give you the specific files states that you are concerned about, so it is significantly less error prone.

    More about hg status

    To list all files in a mercurial repo do: hg status --all.

    The files will be given a prefix before them when they are listed:

      M = modified
      A = added
      R = removed
      C = clean
      ! = missing (deleted by non-hg command, but still tracked)
      ? = not tracked
      I = ignored
    

    If you want to list only the files in a folder, you can provide a path:

    • hg st --all MyFolder – all files in MyFolder
    • hg sta -i MyFolder – just ignored files in MyFolder.

    As well as the -i for "Ignored" and -a for "Added", other flags are available to list only the files having a particular status.

    Getting help

    Read the other very useful answer here for a comprehensive explanation of the status command. It has down votes because the author has tried to show that you can discover all of the above by asking Mercurial about the status command like this:

    hg help status
    

    You can ask Mercurial to tell you about any of it's commands like this. And if you want a list of Mercurial's commands, then type hg help.

提交回复
热议问题