[PATCH 11 of 35] relink: declare command using decorator
Gregory Szorc
gregory.szorc at gmail.com
Mon May 5 00:51:16 CDT 2014
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# 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 <brendan at kublai.com>
#
# 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'
+ at 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]')
- )
-}
More information about the Mercurial-devel
mailing list