We have supported 'no-' prefixes for boolean flag for a few years now,
so I was expecting it to be --no-dates.
I noticed that we have --nodates options for a few more commands
(e.g. hg diff), but I'll leave that for another day.
durin42 |
hg-reviewers |
We have supported 'no-' prefixes for boolean flag for a few years now,
so I was expecting it to be --no-dates.
I noticed that we have --nodates options for a few more commands
(e.g. hg diff), but I'll leave that for another day.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/debugcommands.py (9 lines) | |||
M | tests/test-backout.t (4 lines) | |||
M | tests/test-completion.t (2 lines) | |||
M | tests/test-filebranch.t (2 lines) | |||
M | tests/test-largefiles-update.t (4 lines) | |||
M | tests/test-largefiles.t (4 lines) | |||
M | tests/test-merge-remove.t (8 lines) | |||
M | tests/test-narrow-commit.t (2 lines) | |||
M | tests/test-rebuildstate.t (14 lines) | |||
M | tests/test-sparse.t (8 lines) |
readsize=readsize, largestblock=largestblock, | readsize=readsize, largestblock=largestblock, | ||||
readdensity=readdensity, srchunks=srchunks) | readdensity=readdensity, srchunks=srchunks) | ||||
fm.plain('\n') | fm.plain('\n') | ||||
fm.end() | fm.end() | ||||
@command('debugdirstate|debugstate', | @command('debugdirstate|debugstate', | ||||
[('', 'nodates', None, _('do not display the saved mtime')), | [('', 'nodates', None, _('do not display the saved mtime (DEPRECATED)')), | ||||
('', 'dates', True, _('display the saved mtime')), | |||||
('', 'datesort', None, _('sort by saved mtime'))], | ('', 'datesort', None, _('sort by saved mtime'))], | ||||
_('[OPTION]...')) | _('[OPTION]...')) | ||||
def debugstate(ui, repo, **opts): | def debugstate(ui, repo, **opts): | ||||
"""show the contents of the current dirstate""" | """show the contents of the current dirstate""" | ||||
nodates = opts.get(r'nodates') | nodates = not opts[r'dates'] | ||||
if opts.get(r'nodates') is not None: | |||||
nodates = True | |||||
datesort = opts.get(r'datesort') | datesort = opts.get(r'datesort') | ||||
timestr = "" | timestr = "" | ||||
if datesort: | if datesort: | ||||
keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename | keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename | ||||
else: | else: | ||||
keyfunc = None # sort by filename | keyfunc = None # sort by filename | ||||
for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc): | for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc): |
adding b | adding b | ||||
$ echo 'newly added' > c | $ echo 'newly added' > c | ||||
$ hg add c | $ hg add c | ||||
$ hg remove b | $ hg remove b | ||||
$ hg commit -d '5 0' -m 'prepare for subsequent backout' | $ hg commit -d '5 0' -m 'prepare for subsequent backout' | ||||
$ touch -t 200001010000 c | $ touch -t 200001010000 c | ||||
$ hg status -A | $ hg status -A | ||||
C c | C c | ||||
$ hg debugstate --nodates | $ hg debugstate --no-dates | ||||
n 644 12 set c | n 644 12 set c | ||||
$ hg backout -d '6 0' -m 'to be rollback-ed soon' -r . | $ hg backout -d '6 0' -m 'to be rollback-ed soon' -r . | ||||
removing c | removing c | ||||
adding b | adding b | ||||
changeset 6:4bfec048029d backs out changeset 5:fac0b729a654 | changeset 6:4bfec048029d backs out changeset 5:fac0b729a654 | ||||
$ hg rollback -q | $ hg rollback -q | ||||
$ hg status -A | $ hg status -A | ||||
A b | A b | ||||
R c | R c | ||||
$ hg debugstate --nodates | $ hg debugstate --no-dates | ||||
a 0 -1 unset b | a 0 -1 unset b | ||||
r 0 0 set c | r 0 0 set c | ||||
across branch | across branch | ||||
$ cd .. | $ cd .. | ||||
$ hg init branch | $ hg init branch | ||||
$ cd branch | $ cd branch |
debugcolor: style | debugcolor: style | ||||
debugcommands: | debugcommands: | ||||
debugcomplete: options | debugcomplete: options | ||||
debugcreatestreamclonebundle: | debugcreatestreamclonebundle: | ||||
debugdag: tags, branches, dots, spaces | debugdag: tags, branches, dots, spaces | ||||
debugdata: changelog, manifest, dir | debugdata: changelog, manifest, dir | ||||
debugdate: extended | debugdate: extended | ||||
debugdeltachain: changelog, manifest, dir, template | debugdeltachain: changelog, manifest, dir, template | ||||
debugdirstate: nodates, datesort | debugdirstate: nodates, dates, datesort | ||||
debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure | debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure | ||||
debugdownload: output | debugdownload: output | ||||
debugextensions: template | debugextensions: template | ||||
debugfileset: rev, all-files, show-matcher, show-stage | debugfileset: rev, all-files, show-matcher, show-stage | ||||
debugformat: template | debugformat: template | ||||
debugfsinfo: | debugfsinfo: | ||||
debuggetbundle: head, common, type | debuggetbundle: head, common, type | ||||
debugignore: | debugignore: |
$ cd .. | $ cd .. | ||||
$ cd b | $ cd b | ||||
$ echo 2b > foo | $ echo 2b > foo | ||||
$ echo 2b > baz | $ echo 2b > baz | ||||
$ hg commit -m "branch b" | $ hg commit -m "branch b" | ||||
We shouldn't have anything but n state here: | We shouldn't have anything but n state here: | ||||
$ hg debugstate --nodates | grep -v "^n" | $ hg debugstate --no-dates | grep -v "^n" | ||||
[1] | [1] | ||||
Merging: | Merging: | ||||
$ hg pull ../a | $ hg pull ../a | ||||
pulling from ../a | pulling from ../a | ||||
searching for changes | searching for changes | ||||
adding changesets | adding changesets |
(modified largefile is already switched to normal) | (modified largefile is already switched to normal) | ||||
$ hg update -q -C 2 | $ hg update -q -C 2 | ||||
$ echo 'modified large2 for linear merge' > large2 | $ echo 'modified large2 for linear merge' > large2 | ||||
$ hg update -q 5 | $ hg update -q 5 | ||||
remote turned local largefile large2 into a normal file | remote turned local largefile large2 into a normal file | ||||
keep (l)argefile or use (n)ormal file? l | keep (l)argefile or use (n)ormal file? l | ||||
$ hg debugdirstate --nodates | grep large2 | $ hg debugdirstate --no-dates | grep large2 | ||||
a 0 -1 unset .hglf/large2 | a 0 -1 unset .hglf/large2 | ||||
r 0 0 set large2 | r 0 0 set large2 | ||||
$ hg status -A large2 | $ hg status -A large2 | ||||
A large2 | A large2 | ||||
$ cat large2 | $ cat large2 | ||||
modified large2 for linear merge | modified large2 for linear merge | ||||
(added largefile is already committed as normal) | (added largefile is already committed as normal) | ||||
$ hg update -q -C 2 | $ hg update -q -C 2 | ||||
$ echo 'large3 as large file for linear merge' > large3 | $ echo 'large3 as large file for linear merge' > large3 | ||||
$ hg add --large large3 | $ hg add --large large3 | ||||
$ hg update -q 5 | $ hg update -q 5 | ||||
remote turned local largefile large3 into a normal file | remote turned local largefile large3 into a normal file | ||||
keep (l)argefile or use (n)ormal file? l | keep (l)argefile or use (n)ormal file? l | ||||
$ hg debugdirstate --nodates | grep large3 | $ hg debugdirstate --no-dates | grep large3 | ||||
a 0 -1 unset .hglf/large3 | a 0 -1 unset .hglf/large3 | ||||
r 0 0 set large3 | r 0 0 set large3 | ||||
$ hg status -A large3 | $ hg status -A large3 | ||||
A large3 | A large3 | ||||
$ cat large3 | $ cat large3 | ||||
large3 as large file for linear merge | large3 as large file for linear merge | ||||
$ rm -f large3 .hglf/large3 | $ rm -f large3 .hglf/large3 | ||||
Invoking status precommit hook | Invoking status precommit hook | ||||
A large1 | A large1 | ||||
A normal1 | A normal1 | ||||
A sub/large2 | A sub/large2 | ||||
A sub/normal2 | A sub/normal2 | ||||
$ touch large1 sub/large2 | $ touch large1 sub/large2 | ||||
$ sleep 1 | $ sleep 1 | ||||
$ hg st | $ hg st | ||||
$ hg debugstate --nodates | $ hg debugstate --no-dates | ||||
n 644 41 set .hglf/large1 | n 644 41 set .hglf/large1 | ||||
n 644 41 set .hglf/sub/large2 | n 644 41 set .hglf/sub/large2 | ||||
n 644 8 set normal1 | n 644 8 set normal1 | ||||
n 644 8 set sub/normal2 | n 644 8 set sub/normal2 | ||||
$ hg debugstate --large --nodates | $ hg debugstate --large --no-dates | ||||
n 644 7 set large1 | n 644 7 set large1 | ||||
n 644 7 set sub/large2 | n 644 7 set sub/large2 | ||||
$ echo normal11 > normal1 | $ echo normal11 > normal1 | ||||
$ echo normal22 > sub/normal2 | $ echo normal22 > sub/normal2 | ||||
$ echo large11 > large1 | $ echo large11 > large1 | ||||
$ echo large22 > sub/large2 | $ echo large22 > sub/large2 | ||||
$ hg commit -m "edit files" | $ hg commit -m "edit files" | ||||
Invoking status precommit hook | Invoking status precommit hook |
$ hg ci -m 'mv foo foo1' | $ hg ci -m 'mv foo foo1' | ||||
created new head | created new head | ||||
$ hg merge | $ hg merge | ||||
merging foo1 and foo to foo1 | merging foo1 and foo to foo1 | ||||
1 files updated, 1 files merged, 0 files removed, 0 files unresolved | 1 files updated, 1 files merged, 0 files removed, 0 files unresolved | ||||
(branch merge, don't forget to commit) | (branch merge, don't forget to commit) | ||||
$ hg debugstate --nodates | $ hg debugstate --no-dates | ||||
m 0 -2 unset bar | m 0 -2 unset bar | ||||
m 0 -2 unset foo1 | m 0 -2 unset foo1 | ||||
copy: foo -> foo1 | copy: foo -> foo1 | ||||
$ hg st -q | $ hg st -q | ||||
M bar | M bar | ||||
M foo1 | M foo1 | ||||
Removing foo1 and bar: | Removing foo1 and bar: | ||||
$ cp foo1 F | $ cp foo1 F | ||||
$ cp bar B | $ cp bar B | ||||
$ hg rm -f foo1 bar | $ hg rm -f foo1 bar | ||||
$ hg debugstate --nodates | $ hg debugstate --no-dates | ||||
r 0 -1 set bar | r 0 -1 set bar | ||||
r 0 -1 set foo1 | r 0 -1 set foo1 | ||||
copy: foo -> foo1 | copy: foo -> foo1 | ||||
$ hg st -qC | $ hg st -qC | ||||
R bar | R bar | ||||
R foo1 | R foo1 | ||||
Re-adding foo1 and bar: | Re-adding foo1 and bar: | ||||
$ cp F foo1 | $ cp F foo1 | ||||
$ cp B bar | $ cp B bar | ||||
$ hg add -v foo1 bar | $ hg add -v foo1 bar | ||||
adding bar | adding bar | ||||
adding foo1 | adding foo1 | ||||
$ hg debugstate --nodates | $ hg debugstate --no-dates | ||||
n 0 -2 unset bar | n 0 -2 unset bar | ||||
n 0 -2 unset foo1 | n 0 -2 unset foo1 | ||||
copy: foo -> foo1 | copy: foo -> foo1 | ||||
$ hg st -qC | $ hg st -qC | ||||
M bar | M bar | ||||
M foo1 | M foo1 | ||||
foo | foo | ||||
Reverting foo1 and bar: | Reverting foo1 and bar: | ||||
$ hg revert -vr . foo1 bar | $ hg revert -vr . foo1 bar | ||||
saving current version of bar as bar.orig | saving current version of bar as bar.orig | ||||
saving current version of foo1 as foo1.orig | saving current version of foo1 as foo1.orig | ||||
reverting bar | reverting bar | ||||
reverting foo1 | reverting foo1 | ||||
$ hg debugstate --nodates | $ hg debugstate --no-dates | ||||
n 0 -2 unset bar | n 0 -2 unset bar | ||||
n 0 -2 unset foo1 | n 0 -2 unset foo1 | ||||
copy: foo -> foo1 | copy: foo -> foo1 | ||||
$ hg st -qC | $ hg st -qC | ||||
M bar | M bar | ||||
M foo1 | M foo1 | ||||
foo | foo |
d0f2f706468ab0e8bec7af87446835fb1b13511b 755 d outside/ (tree !) | d0f2f706468ab0e8bec7af87446835fb1b13511b 755 d outside/ (tree !) | ||||
Some filesystems (notably FAT/exFAT only store timestamps with 2 | Some filesystems (notably FAT/exFAT only store timestamps with 2 | ||||
seconds of precision, so by sleeping for 3 seconds, we can ensure that | seconds of precision, so by sleeping for 3 seconds, we can ensure that | ||||
the timestamps of files stored by dirstate will appear older than the | the timestamps of files stored by dirstate will appear older than the | ||||
dirstate file, and therefore we'll be able to get stable output from | dirstate file, and therefore we'll be able to get stable output from | ||||
debugdirstate. If we don't do this, the test can be slightly flaky. | debugdirstate. If we don't do this, the test can be slightly flaky. | ||||
$ sleep 3 | $ sleep 3 | ||||
$ hg status | $ hg status | ||||
$ hg debugdirstate --nodates | $ hg debugdirstate --no-dates | ||||
n 644 10 set inside/f1 | n 644 10 set inside/f1 |
$ touch baz | $ touch baz | ||||
$ hg add baz | $ hg add baz | ||||
$ hg rm bar | $ hg rm bar | ||||
$ hg debugrebuildstate | $ hg debugrebuildstate | ||||
state dump after | state dump after | ||||
$ hg debugstate --nodates | sort | $ hg debugstate --no-dates | sort | ||||
n 0 -1 unset bar | n 0 -1 unset bar | ||||
n 0 -1 unset foo | n 0 -1 unset foo | ||||
$ hg debugadddrop --normal-lookup file1 file2 | $ hg debugadddrop --normal-lookup file1 file2 | ||||
$ hg debugadddrop --drop bar | $ hg debugadddrop --drop bar | ||||
$ hg debugadddrop --drop | $ hg debugadddrop --drop | ||||
$ hg debugstate --nodates | $ hg debugstate --no-dates | ||||
n 0 -1 unset file1 | n 0 -1 unset file1 | ||||
n 0 -1 unset file2 | n 0 -1 unset file2 | ||||
n 0 -1 unset foo | n 0 -1 unset foo | ||||
$ hg debugrebuildstate | $ hg debugrebuildstate | ||||
status | status | ||||
$ hg st -A | $ hg st -A | ||||
! bar | ! bar | ||||
? baz | ? baz | ||||
C foo | C foo | ||||
Test debugdirstate --minimal where a file is not in parent manifest | Test debugdirstate --minimal where a file is not in parent manifest | ||||
but in the dirstate | but in the dirstate | ||||
$ touch foo bar qux | $ touch foo bar qux | ||||
$ hg add qux | $ hg add qux | ||||
$ hg remove bar | $ hg remove bar | ||||
$ hg status -A | $ hg status -A | ||||
A qux | A qux | ||||
R bar | R bar | ||||
? baz | ? baz | ||||
C foo | C foo | ||||
$ hg debugadddrop --normal-lookup baz | $ hg debugadddrop --normal-lookup baz | ||||
$ hg debugdirstate --nodates | $ hg debugdirstate --no-dates | ||||
r 0 0 * bar (glob) | r 0 0 * bar (glob) | ||||
n 0 -1 * baz (glob) | n 0 -1 * baz (glob) | ||||
n 644 0 * foo (glob) | n 644 0 * foo (glob) | ||||
a 0 -1 * qux (glob) | a 0 -1 * qux (glob) | ||||
$ hg debugrebuilddirstate --minimal | $ hg debugrebuilddirstate --minimal | ||||
$ hg debugdirstate --nodates | $ hg debugdirstate --no-dates | ||||
r 0 0 * bar (glob) | r 0 0 * bar (glob) | ||||
n 644 0 * foo (glob) | n 644 0 * foo (glob) | ||||
a 0 -1 * qux (glob) | a 0 -1 * qux (glob) | ||||
$ hg status -A | $ hg status -A | ||||
A qux | A qux | ||||
R bar | R bar | ||||
? baz | ? baz | ||||
C foo | C foo | ||||
Test debugdirstate --minimal where file is in the parent manifest but not the | Test debugdirstate --minimal where file is in the parent manifest but not the | ||||
dirstate | dirstate | ||||
$ hg manifest | $ hg manifest | ||||
bar | bar | ||||
foo | foo | ||||
$ hg status -A | $ hg status -A | ||||
A qux | A qux | ||||
R bar | R bar | ||||
? baz | ? baz | ||||
C foo | C foo | ||||
$ hg debugdirstate --nodates | $ hg debugdirstate --no-dates | ||||
r 0 0 * bar (glob) | r 0 0 * bar (glob) | ||||
n 644 0 * foo (glob) | n 644 0 * foo (glob) | ||||
a 0 -1 * qux (glob) | a 0 -1 * qux (glob) | ||||
$ hg debugadddrop --drop foo | $ hg debugadddrop --drop foo | ||||
$ hg debugdirstate --nodates | $ hg debugdirstate --no-dates | ||||
r 0 0 * bar (glob) | r 0 0 * bar (glob) | ||||
a 0 -1 * qux (glob) | a 0 -1 * qux (glob) | ||||
$ hg debugrebuilddirstate --minimal | $ hg debugrebuilddirstate --minimal | ||||
$ hg debugdirstate --nodates | $ hg debugdirstate --no-dates | ||||
r 0 0 * bar (glob) | r 0 0 * bar (glob) | ||||
n 0 -1 * foo (glob) | n 0 -1 * foo (glob) | ||||
a 0 -1 * qux (glob) | a 0 -1 * qux (glob) | ||||
$ hg status -A | $ hg status -A | ||||
A qux | A qux | ||||
R bar | R bar | ||||
? baz | ? baz | ||||
C foo | C foo | ||||
$ hg debugsparse -X included | $ hg debugsparse -X included | ||||
$ hg debugdirstate | $ hg debugdirstate | ||||
$ cp .hg/dirstate ../dirstateallexcluded | $ cp .hg/dirstate ../dirstateallexcluded | ||||
$ hg debugsparse --reset | $ hg debugsparse --reset | ||||
$ hg debugsparse -X excluded | $ hg debugsparse -X excluded | ||||
$ cp ../dirstateallexcluded .hg/dirstate | $ cp ../dirstateallexcluded .hg/dirstate | ||||
$ touch includedadded | $ touch includedadded | ||||
$ hg add includedadded | $ hg add includedadded | ||||
$ hg debugdirstate --nodates | $ hg debugdirstate --no-dates | ||||
a 0 -1 unset includedadded | a 0 -1 unset includedadded | ||||
$ hg debugrebuilddirstate --minimal | $ hg debugrebuilddirstate --minimal | ||||
$ hg debugdirstate --nodates | $ hg debugdirstate --no-dates | ||||
n 0 -1 unset included | n 0 -1 unset included | ||||
a 0 -1 * includedadded (glob) | a 0 -1 * includedadded (glob) | ||||
Test debugdirstate --minimal where a file is not in parent manifest | Test debugdirstate --minimal where a file is not in parent manifest | ||||
but in the dirstate. This should take into account excluded files in the | but in the dirstate. This should take into account excluded files in the | ||||
manifest | manifest | ||||
$ cp ../dirstateboth .hg/dirstate | $ cp ../dirstateboth .hg/dirstate | ||||
$ touch includedadded | $ touch includedadded | ||||
$ hg add includedadded | $ hg add includedadded | ||||
$ touch excludednomanifest | $ touch excludednomanifest | ||||
$ hg add excludednomanifest | $ hg add excludednomanifest | ||||
$ cp .hg/dirstate ../moreexcluded | $ cp .hg/dirstate ../moreexcluded | ||||
$ hg forget excludednomanifest | $ hg forget excludednomanifest | ||||
$ rm excludednomanifest | $ rm excludednomanifest | ||||
$ hg debugsparse -X excludednomanifest | $ hg debugsparse -X excludednomanifest | ||||
$ cp ../moreexcluded .hg/dirstate | $ cp ../moreexcluded .hg/dirstate | ||||
$ hg manifest | $ hg manifest | ||||
excluded | excluded | ||||
included | included | ||||
We have files in the dirstate that are included and excluded. Some are in the | We have files in the dirstate that are included and excluded. Some are in the | ||||
manifest and some are not. | manifest and some are not. | ||||
$ hg debugdirstate --nodates | $ hg debugdirstate --no-dates | ||||
n 644 0 * excluded (glob) | n 644 0 * excluded (glob) | ||||
a 0 -1 * excludednomanifest (glob) | a 0 -1 * excludednomanifest (glob) | ||||
n 644 0 * included (glob) | n 644 0 * included (glob) | ||||
a 0 -1 * includedadded (glob) | a 0 -1 * includedadded (glob) | ||||
$ hg debugrebuilddirstate --minimal | $ hg debugrebuilddirstate --minimal | ||||
$ hg debugdirstate --nodates | $ hg debugdirstate --no-dates | ||||
n 644 0 * included (glob) | n 644 0 * included (glob) | ||||
a 0 -1 * includedadded (glob) | a 0 -1 * includedadded (glob) | ||||