From patchwork Mon May 5 05:51:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [11,of,35] relink: declare command using decorator From: Gregory Szorc X-Patchwork-Id: 4602 Message-Id: To: mercurial-devel@selenic.com Date: Sun, 04 May 2014 22:51:16 -0700 # HG changeset patch # User Gregory Szorc # Date 1399265545 25200 # Sun May 04 21:52:25 2014 -0700 # Branch stable # Node ID cd2b984754b857109c16bfd85ebb94565089bc82 # Parent d29ede43f707818fe796cb5e8fd44367de6c9e0b relink: declare command using decorator diff --git a/hgext/relink.py b/hgext/relink.py --- a/hgext/relink.py +++ b/hgext/relink.py @@ -2,22 +2,25 @@ # # Copyright (C) 2007 Brendan Cully # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. """recreates hardlinks between repository clones""" -from mercurial import hg, util +from mercurial import cmdutil, hg, util from mercurial.i18n import _ import os, stat +cmdtable = {} +command = cmdutil.command(cmdtable) testedwith = 'internal' +@command('relink', [], _('[ORIGIN]')) def relink(ui, repo, origin=None, **opts): """recreate hardlinks between two repositories When repositories are cloned locally, their data files will be hardlinked so that they only use the space of a single repository. Unfortunately, subsequent pulls into either repository will break hardlinks for any files touched by the new changesets, even if @@ -173,16 +176,8 @@ def do_relink(src, dst, files, ui): savedbytes += sz except OSError, inst: ui.warn('%s: %s\n' % (tgt, str(inst))) ui.progress(_('relinking'), None) ui.status(_('relinked %d files (%s reclaimed)\n') % (relinked, util.bytecount(savedbytes))) - -cmdtable = { - 'relink': ( - relink, - [], - _('[ORIGIN]') - ) -}