Changeset View
Changeset View
Standalone View
Standalone View
hgext/narrow/narrowcommands.py
Show All 30 Lines | from mercurial import ( | ||||
registrar, | registrar, | ||||
repair, | repair, | ||||
repoview, | repoview, | ||||
requirements, | requirements, | ||||
sparse, | sparse, | ||||
util, | util, | ||||
wireprototypes, | wireprototypes, | ||||
) | ) | ||||
from mercurial.utils import ( | |||||
urlutil, | |||||
) | |||||
table = {} | table = {} | ||||
command = registrar.command(table) | command = registrar.command(table) | ||||
def setup(): | def setup(): | ||||
"""Wraps user-facing mercurial commands with narrow-aware versions.""" | """Wraps user-facing mercurial commands with narrow-aware versions.""" | ||||
▲ Show 20 Lines • Show All 540 Lines • ▼ Show 20 Line(s) | def trackedcmd(ui, repo, remotepath=None, *pats, **opts): | ||||
with repo.wlock(), repo.lock(): | with repo.wlock(), repo.lock(): | ||||
cmdutil.bailifchanged(repo) | cmdutil.bailifchanged(repo) | ||||
# Find the revisions we have in common with the remote. These will | # Find the revisions we have in common with the remote. These will | ||||
# be used for finding local-only changes for narrowing. They will | # be used for finding local-only changes for narrowing. They will | ||||
# also define the set of revisions to update for widening. | # also define the set of revisions to update for widening. | ||||
remotepath = ui.expandpath(remotepath or b'default') | remotepath = ui.expandpath(remotepath or b'default') | ||||
url, branches = hg.parseurl(remotepath) | url, branches = hg.parseurl(remotepath) | ||||
ui.status(_(b'comparing with %s\n') % util.hidepassword(url)) | ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(url)) | ||||
remote = hg.peer(repo, opts, url) | remote = hg.peer(repo, opts, url) | ||||
try: | try: | ||||
# check narrow support before doing anything if widening needs to be | # check narrow support before doing anything if widening needs to be | ||||
# performed. In future we should also abort if client is ellipses and | # performed. In future we should also abort if client is ellipses and | ||||
# server does not support ellipses | # server does not support ellipses | ||||
if ( | if ( | ||||
widening | widening | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |