D2097: infinitepush: remove backupcommands.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHGde4c2f3af97f: infinitepush: remove backupcommands.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2097?vs=5358=7412 REVISION DETAIL https://phab.mercurial-scm.org/D2097 AFFECTED FILES hgext/infinitepush/__init__.py hgext/infinitepush/backupcommands.py hgext/infinitepush/infinitepushcommands.py CHANGE DETAILS diff --git a/hgext/infinitepush/infinitepushcommands.py b/hgext/infinitepush/infinitepushcommands.py --- a/hgext/infinitepush/infinitepushcommands.py +++ b/hgext/infinitepush/infinitepushcommands.py @@ -30,13 +30,12 @@ ) from . import ( -backupcommands, common, ) downloadbundle = common.downloadbundle -cmdtable = backupcommands.cmdtable +cmdtable = {} command = registrar.command(cmdtable) @command('debugfillinfinitepushmetadata', diff --git a/hgext/infinitepush/backupcommands.py b/hgext/infinitepush/backupcommands.py deleted file mode 100644 --- a/hgext/infinitepush/backupcommands.py +++ /dev/null @@ -1,992 +0,0 @@ -# Copyright 2017 Facebook, Inc. -# -# This software may be used and distributed according to the terms of the -# GNU General Public License version 2 or any later version. -""" -[infinitepushbackup] -# Whether to enable automatic backups. If this option is True then a backup -# process will be started after every mercurial command that modifies the -# repo, for example, commit, amend, histedit, rebase etc. -autobackup = False - -# path to the directory where pushback logs should be stored -logdir = path/to/dir - -# Backup at most maxheadstobackup heads, other heads are ignored. -# Negative number means backup everything. -maxheadstobackup = -1 - -# Nodes that should not be backed up. Ancestors of these nodes won't be -# backed up either -dontbackupnodes = [] - -# Special option that may be used to trigger re-backuping. For example, -# if there was a bug in infinitepush backups, then changing the value of -# this option will force all clients to make a "clean" backup -backupgeneration = 0 - -# Hostname value to use. If not specified then socket.gethostname() will -# be used -hostname = '' - -# Enable reporting of infinitepush backup status as a summary at the end -# of smartlog. -enablestatus = False - -# Whether or not to save information about the latest successful backup. -# This information includes the local revision number and unix timestamp -# of the last time we successfully made a backup. -savelatestbackupinfo = False -""" - -from __future__ import absolute_import - -import collections -import errno -import json -import os -import re -import socket -import stat -import subprocess -import time - -from mercurial.node import ( -bin, -hex, -nullrev, -short, -) - -from mercurial.i18n import _ - -from mercurial import ( -bundle2, -changegroup, -commands, -discovery, -dispatch, -encoding, -error, -extensions, -hg, -localrepo, -lock as lockmod, -phases, -policy, -registrar, -scmutil, -util, -) - -from . import bundleparts - -getscratchbookmarkspart = bundleparts.getscratchbookmarkspart -getscratchbranchparts = bundleparts.getscratchbranchparts - -from hgext3rd import shareutil - -osutil = policy.importmod(r'osutil') - -cmdtable = {} -command = registrar.command(cmdtable) -revsetpredicate = registrar.revsetpredicate() -templatekeyword = registrar.templatekeyword() - -backupbookmarktuple = collections.namedtuple('backupbookmarktuple', - ['hostname', 'reporoot', 'localbookmark']) - -class backupstate(object): -def __init__(self): -self.heads = set() -self.localbookmarks = {} - -def empty(self): -return not self.heads and not self.localbookmarks - -class WrongPermissionsException(Exception): -def __init__(self, logdir): -self.logdir = logdir - -restoreoptions = [ - ('', 'reporoot', '', 'root of the repo to restore'), - ('', 'user', '', 'user who ran the backup'), - ('', 'hostname', '', 'hostname of the repo to restore'), -] - -_backuplockname = 'infinitepushbackup.lock' - -def extsetup(ui): -if ui.configbool('infinitepushbackup', 'autobackup', False): -extensions.wrapfunction(dispatch, 'runcommand', -_autobackupruncommandwrapper) -extensions.wrapfunction(localrepo.localrepository, 'transaction', -_transaction) - -@command('pushbackup', - [('', 'background', None, 'run backup in background')]) -def backup(ui, repo, dest=None, **opts): -""" -Pushes commits, bookmarks and heads to infinitepush. -New non-extinct commits are saved since the last `hg pushbackup` -or since 0 revision if this backup is the first. -
D2097: infinitepush: remove backupcommands.py
indygreg accepted this revision. indygreg added a comment. This revision is now accepted and ready to land. This is a nifty feature. But I agree it is beyond scope of the initial landing of this feature. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2097 To: pulkit, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2097: infinitepush: remove backupcommands.py
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This file contains command pushbackup and pullbackup which are used to store things to infinitepush. This is an advanced functionality which we don't require as of now. Also this uses shareutil.py from fb-hgext/ which is not there in core. Therefore this patch deletes the file and the config option which belongs to the backup thing. If we need this functionality in future, we can always move this file back. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2097 AFFECTED FILES hgext/infinitepush/__init__.py hgext/infinitepush/backupcommands.py hgext/infinitepush/infinitepushcommands.py CHANGE DETAILS diff --git a/hgext/infinitepush/infinitepushcommands.py b/hgext/infinitepush/infinitepushcommands.py --- a/hgext/infinitepush/infinitepushcommands.py +++ b/hgext/infinitepush/infinitepushcommands.py @@ -30,13 +30,12 @@ ) from . import ( -backupcommands, common, ) downloadbundle = common.downloadbundle -cmdtable = backupcommands.cmdtable +cmdtable = {} command = registrar.command(cmdtable) @command('debugfillinfinitepushmetadata', diff --git a/hgext/infinitepush/backupcommands.py b/hgext/infinitepush/backupcommands.py deleted file mode 100644 --- a/hgext/infinitepush/backupcommands.py +++ /dev/null @@ -1,992 +0,0 @@ -# Copyright 2017 Facebook, Inc. -# -# This software may be used and distributed according to the terms of the -# GNU General Public License version 2 or any later version. -""" -[infinitepushbackup] -# Whether to enable automatic backups. If this option is True then a backup -# process will be started after every mercurial command that modifies the -# repo, for example, commit, amend, histedit, rebase etc. -autobackup = False - -# path to the directory where pushback logs should be stored -logdir = path/to/dir - -# Backup at most maxheadstobackup heads, other heads are ignored. -# Negative number means backup everything. -maxheadstobackup = -1 - -# Nodes that should not be backed up. Ancestors of these nodes won't be -# backed up either -dontbackupnodes = [] - -# Special option that may be used to trigger re-backuping. For example, -# if there was a bug in infinitepush backups, then changing the value of -# this option will force all clients to make a "clean" backup -backupgeneration = 0 - -# Hostname value to use. If not specified then socket.gethostname() will -# be used -hostname = '' - -# Enable reporting of infinitepush backup status as a summary at the end -# of smartlog. -enablestatus = False - -# Whether or not to save information about the latest successful backup. -# This information includes the local revision number and unix timestamp -# of the last time we successfully made a backup. -savelatestbackupinfo = False -""" - -from __future__ import absolute_import - -import collections -import errno -import json -import os -import re -import socket -import stat -import subprocess -import time - -from mercurial.node import ( -bin, -hex, -nullrev, -short, -) - -from mercurial.i18n import _ - -from mercurial import ( -bundle2, -changegroup, -commands, -discovery, -dispatch, -encoding, -error, -extensions, -hg, -localrepo, -lock as lockmod, -phases, -policy, -registrar, -scmutil, -util, -) - -from . import bundleparts - -getscratchbookmarkspart = bundleparts.getscratchbookmarkspart -getscratchbranchparts = bundleparts.getscratchbranchparts - -from hgext3rd import shareutil - -osutil = policy.importmod(r'osutil') - -cmdtable = {} -command = registrar.command(cmdtable) -revsetpredicate = registrar.revsetpredicate() -templatekeyword = registrar.templatekeyword() - -backupbookmarktuple = collections.namedtuple('backupbookmarktuple', - ['hostname', 'reporoot', 'localbookmark']) - -class backupstate(object): -def __init__(self): -self.heads = set() -self.localbookmarks = {} - -def empty(self): -return not self.heads and not self.localbookmarks - -class WrongPermissionsException(Exception): -def __init__(self, logdir): -self.logdir = logdir - -restoreoptions = [ - ('', 'reporoot', '', 'root of the repo to restore'), - ('', 'user', '', 'user who ran the backup'), - ('', 'hostname', '', 'hostname of the repo to restore'), -] - -_backuplockname = 'infinitepushbackup.lock' - -def extsetup(ui): -if ui.configbool('infinitepushbackup', 'autobackup', False): -extensions.wrapfunction(dispatch, 'runcommand', -_autobackupruncommandwrapper) -extensions.wrapfunction(localrepo.localrepository, 'transaction', -_transaction) - -@command('pushbackup', -