mercurial/debugcommands.py
changeset 47674 ff97e793ed36
parent 47568 85ce6ed51b9c
child 47676 096ee2e260a3
equal deleted inserted replaced
47673:37825a85d3b0 47674:ff97e793ed36
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 from __future__ import absolute_import
     8 from __future__ import absolute_import
     9 
     9 
       
    10 import binascii
    10 import codecs
    11 import codecs
    11 import collections
    12 import collections
    12 import contextlib
    13 import contextlib
    13 import difflib
    14 import difflib
    14 import errno
    15 import errno
   985     for f in repo.dirstate.copies():
   986     for f in repo.dirstate.copies():
   986         ui.write(_(b"copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
   987         ui.write(_(b"copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
   987 
   988 
   988 
   989 
   989 @command(
   990 @command(
       
   991     b'debugdirstateignorepatternshash',
       
   992     [],
       
   993     _(b''),
       
   994 )
       
   995 def debugdirstateignorepatternshash(ui, repo, **opts):
       
   996     """show the hash of ignore patterns stored in dirstate if v2,
       
   997     or nothing for dirstate-v2
       
   998     """
       
   999     if repo.dirstate._use_dirstate_v2:
       
  1000         hash_offset = 16  # Four 32-bit integers before this field
       
  1001         hash_len = 20  # 160 bits for SHA-1
       
  1002         data_filename = repo.dirstate._map.docket.data_filename()
       
  1003         with repo.vfs(data_filename) as f:
       
  1004             hash_bytes = f.read(hash_offset + hash_len)[-hash_len:]
       
  1005         ui.write(binascii.hexlify(hash_bytes) + b'\n')
       
  1006 
       
  1007 
       
  1008 @command(
   990     b'debugdiscovery',
  1009     b'debugdiscovery',
   991     [
  1010     [
   992         (b'', b'old', None, _(b'use old-style discovery')),
  1011         (b'', b'old', None, _(b'use old-style discovery')),
   993         (
  1012         (
   994             b'',
  1013             b'',