Jak wyświetlić listę wszystkich plików w repozytorium w Mercurial (hg)?

Czy istnieje polecenie w mercurial, które wyświetli listę wszystkich plików znajdujących się obecnie pod kontrolą źródła?

Mogę zrobić dir /s aby wyświetlić listę wszystkich plików w moim folderze i podfolderach, ale nie mam pojęcia, które zostały dodane do mojego repozytorium. Mam wiele wykluczonych typów plików i folderów i chcę sprawdzić, czy żaden z nich nie został dodany przed skonfigurowaniem ich w moim .plik hgignore.

Author: JamesWampler, 2010-06-08

5 answers

hg status --all wyświetli wszystkie pliki w drzewie z literą wskazującą jego status: M dla modified, C dla clean (własność hg) i I dla ignored.

Dla tylko ignorowanych plików, użyj hg status -i. Dla plików, które zostaną dodane przy następnym zatwierdzeniu, użyj hg status -a. Pokazują one tylko to, co musisz wiedzieć i nie wymagają skanowania długiej listy plików.

 72
Author: Ned Batchelder,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-01-28 16:33:13

Możesz również sprawdzić komendę {[3] }. Używam go wraz z opcją -I, Gdy chcę ograniczyć pliki do określonego katalogu.

Aby wyświetlić listę wszystkich plików w repozytorium:

hg locate

Z katalogu repozytorium ("root"):

hg locate -I dir/sub_dir/dir_of_interest

Ścieżka przekazywana do -I musi ulec zmianie w zależności od katalogu, w którym uruchomisz polecenie. Jeśli uruchomisz polecenie z katalogu dir w powyższym przykładzie, musisz zmodyfikować swój argument do locate:

hg locate -I sub_dir/dir_of_interest

Lista plików wyjściowych pozostanie taka sama, pokazując pełną ścieżkę KAŻDEGO pliku w repozytorium.

Spróbuj hg help -v locate aby uzyskać więcej informacji.

 59
Author: JS.,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-10-07 15:14:01

hg manifest wyświetli tylko pliki w repozytorium, podczas gdy hg status --all wyświetli wszystkie pliki w strukturze repozytorium i będzie zawierać znacznik, dla którego są śledzone, a które nie.

 20
Author: Mike Pape,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-08-24 22:26:18

Wyświetlanie Tylko Ignorowanych Lub Dodanych Plików

Aby wyświetlić tylko pliki ignorowane , wykonaj: hg status -i.

Dla tylko dodanych plików, do hg status -a.

Jeśli nie lubisz pisać zbytnio, możesz je skrócić do hg sta -i i hg sta -a.

Te dwa zastosowania status są prostsze niż locate i dadzą ci określone stany plików, które Cię interesują, więc jest znacznie mniej podatne na błędy.

Więcej o hg status

Do listy wszystkie pliki w repo mercurial do: hg status --all.

Pliki będą miały przed nimi prefiks, gdy zostaną wymienione:

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

Jeśli chcesz wyświetlać tylko pliki w folderze , możesz podać ścieżkę:

  • {–10]} - wszystkie pliki w Myfolderze
  • hg sta -i MyFolder - po prostu ignorowane pliki w Myfolderze.

Jak również -i dla " ignorowane "i -a dla" dodane", inne flagi są dostępne do wyświetlenia tylko plików o określonym statusie.

Getting help

Przeczytaj drugą bardzo przydatną odpowiedź tutaj , aby uzyskać wyczerpujące wyjaśnienie polecenia status. Ma mniej głosów, ponieważ autor starał się pokazać, że można odkryć wszystkie powyższe przez pytając Mercurial o status polecenie tak:

hg help status

Możesz poprosić Mercurial, aby powiedział ci o każdej z komend, takich jak ta. A jeśli chcesz listę poleceń Mercuriala, wpisz hg help.

 3
Author: Benjohn,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-05-23 11:47:02
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
 -3
Author: simendsjo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2010-06-08 18:25:07