mercurial/commands.py
changeset 30527 a8b17859684a
parent 30526 a3ec6db36315
child 30528 20a42325fdef
equal deleted inserted replaced
30526:a3ec6db36315 30527:a8b17859684a
     7 
     7 
     8 from __future__ import absolute_import
     8 from __future__ import absolute_import
     9 
     9 
    10 import difflib
    10 import difflib
    11 import errno
    11 import errno
    12 import operator
       
    13 import os
    12 import os
    14 import re
    13 import re
    15 import shlex
    14 import shlex
    16 import socket
    15 import socket
    17 import string
    16 import string
  1858     Returns 0 on success, 1 if errors are encountered.
  1857     Returns 0 on success, 1 if errors are encountered.
  1859     """
  1858     """
  1860     with repo.wlock(False):
  1859     with repo.wlock(False):
  1861         return cmdutil.copy(ui, repo, pats, opts)
  1860         return cmdutil.copy(ui, repo, pats, opts)
  1862 
  1861 
  1863 @command('debugextensions', formatteropts, [], norepo=True)
       
  1864 def debugextensions(ui, **opts):
       
  1865     '''show information about active extensions'''
       
  1866     exts = extensions.extensions(ui)
       
  1867     hgver = util.version()
       
  1868     fm = ui.formatter('debugextensions', opts)
       
  1869     for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
       
  1870         isinternal = extensions.ismoduleinternal(extmod)
       
  1871         extsource = extmod.__file__
       
  1872         if isinternal:
       
  1873             exttestedwith = []  # never expose magic string to users
       
  1874         else:
       
  1875             exttestedwith = getattr(extmod, 'testedwith', '').split()
       
  1876         extbuglink = getattr(extmod, 'buglink', None)
       
  1877 
       
  1878         fm.startitem()
       
  1879 
       
  1880         if ui.quiet or ui.verbose:
       
  1881             fm.write('name', '%s\n', extname)
       
  1882         else:
       
  1883             fm.write('name', '%s', extname)
       
  1884             if isinternal or hgver in exttestedwith:
       
  1885                 fm.plain('\n')
       
  1886             elif not exttestedwith:
       
  1887                 fm.plain(_(' (untested!)\n'))
       
  1888             else:
       
  1889                 lasttestedversion = exttestedwith[-1]
       
  1890                 fm.plain(' (%s!)\n' % lasttestedversion)
       
  1891 
       
  1892         fm.condwrite(ui.verbose and extsource, 'source',
       
  1893                  _('  location: %s\n'), extsource or "")
       
  1894 
       
  1895         if ui.verbose:
       
  1896             fm.plain(_('  bundled: %s\n') % ['no', 'yes'][isinternal])
       
  1897         fm.data(bundled=isinternal)
       
  1898 
       
  1899         fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
       
  1900                      _('  tested with: %s\n'),
       
  1901                      fm.formatlist(exttestedwith, name='ver'))
       
  1902 
       
  1903         fm.condwrite(ui.verbose and extbuglink, 'buglink',
       
  1904                  _('  bug reporting: %s\n'), extbuglink or "")
       
  1905 
       
  1906     fm.end()
       
  1907 
       
  1908 @command('debugfileset',
  1862 @command('debugfileset',
  1909     [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
  1863     [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
  1910     _('[-r REV] FILESPEC'))
  1864     _('[-r REV] FILESPEC'))
  1911 def debugfileset(ui, repo, expr, **opts):
  1865 def debugfileset(ui, repo, expr, **opts):
  1912     '''parse and apply a fileset specification'''
  1866     '''parse and apply a fileset specification'''