Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 30535:9c10905f4b48
debugcommands: move 'debuggetbundle' in the new module
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 10 Nov 2016 09:44:47 -0800 |
parents | 86ebd2f61c31 |
children | 243ecbd4f5c9 |
comparison
equal
deleted
inserted
replaced
30534:86ebd2f61c31 | 30535:9c10905f4b48 |
---|---|
1856 Returns 0 on success, 1 if errors are encountered. | 1856 Returns 0 on success, 1 if errors are encountered. |
1857 """ | 1857 """ |
1858 with repo.wlock(False): | 1858 with repo.wlock(False): |
1859 return cmdutil.copy(ui, repo, pats, opts) | 1859 return cmdutil.copy(ui, repo, pats, opts) |
1860 | 1860 |
1861 @command('debuggetbundle', | |
1862 [('H', 'head', [], _('id of head node'), _('ID')), | |
1863 ('C', 'common', [], _('id of common node'), _('ID')), | |
1864 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))], | |
1865 _('REPO FILE [-H|-C ID]...'), | |
1866 norepo=True) | |
1867 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts): | |
1868 """retrieves a bundle from a repo | |
1869 | |
1870 Every ID must be a full-length hex node id string. Saves the bundle to the | |
1871 given file. | |
1872 """ | |
1873 repo = hg.peer(ui, opts, repopath) | |
1874 if not repo.capable('getbundle'): | |
1875 raise error.Abort("getbundle() not supported by target repository") | |
1876 args = {} | |
1877 if common: | |
1878 args['common'] = [bin(s) for s in common] | |
1879 if head: | |
1880 args['heads'] = [bin(s) for s in head] | |
1881 # TODO: get desired bundlecaps from command line. | |
1882 args['bundlecaps'] = None | |
1883 bundle = repo.getbundle('debug', **args) | |
1884 | |
1885 bundletype = opts.get('type', 'bzip2').lower() | |
1886 btypes = {'none': 'HG10UN', | |
1887 'bzip2': 'HG10BZ', | |
1888 'gzip': 'HG10GZ', | |
1889 'bundle2': 'HG20'} | |
1890 bundletype = btypes.get(bundletype) | |
1891 if bundletype not in bundle2.bundletypes: | |
1892 raise error.Abort(_('unknown bundle type specified with --type')) | |
1893 bundle2.writebundle(ui, bundle, bundlepath, bundletype) | |
1894 | |
1895 @command('debugignore', [], '[FILE]') | 1861 @command('debugignore', [], '[FILE]') |
1896 def debugignore(ui, repo, *files, **opts): | 1862 def debugignore(ui, repo, *files, **opts): |
1897 """display the combined ignore pattern and information about ignored files | 1863 """display the combined ignore pattern and information about ignored files |
1898 | 1864 |
1899 With no argument display the combined ignore pattern. | 1865 With no argument display the combined ignore pattern. |