comparison hgext/relink.py @ 21252:da0eb4970913

relink: declare command using decorator
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 04 May 2014 21:52:25 -0700
parents c69e5911888d
children 80c5b2666a96
comparison
equal deleted inserted replaced
21251:a836fa58b512 21252:da0eb4970913
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 """recreates hardlinks between repository clones""" 8 """recreates hardlinks between repository clones"""
9 9
10 from mercurial import hg, util 10 from mercurial import cmdutil, hg, util
11 from mercurial.i18n import _ 11 from mercurial.i18n import _
12 import os, stat 12 import os, stat
13 13
14 cmdtable = {}
15 command = cmdutil.command(cmdtable)
14 testedwith = 'internal' 16 testedwith = 'internal'
15 17
18 @command('relink', [], _('[ORIGIN]'))
16 def relink(ui, repo, origin=None, **opts): 19 def relink(ui, repo, origin=None, **opts):
17 """recreate hardlinks between two repositories 20 """recreate hardlinks between two repositories
18 21
19 When repositories are cloned locally, their data files will be 22 When repositories are cloned locally, their data files will be
20 hardlinked so that they only use the space of a single repository. 23 hardlinked so that they only use the space of a single repository.
176 179
177 ui.progress(_('relinking'), None) 180 ui.progress(_('relinking'), None)
178 181
179 ui.status(_('relinked %d files (%s reclaimed)\n') % 182 ui.status(_('relinked %d files (%s reclaimed)\n') %
180 (relinked, util.bytecount(savedbytes))) 183 (relinked, util.bytecount(savedbytes)))
181
182 cmdtable = {
183 'relink': (
184 relink,
185 [],
186 _('[ORIGIN]')
187 )
188 }