本文整理汇总了Python中mercurial.util.hidepassword函数的典型用法代码示例。如果您正苦于以下问题:Python hidepassword函数的具体用法?Python hidepassword怎么用?Python hidepassword使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hidepassword函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: put
def put(self, source, hash):
if self.sendfile(source, hash):
raise error.Abort(
_('remotestore: could not put %s to remote store %s')
% (source, util.hidepassword(self.url)))
self.ui.debug(
_('remotestore: put %s to remote store %s\n')
% (source, util.hidepassword(self.url)))
示例2: longmessage
def longmessage(self):
return _("error getting id %s from url %s for file %s: %s\n") % (
self.hash,
util.hidepassword(self.url),
self.filename,
self.detail,
)
示例3: get
def get(self, files):
'''Get the specified largefiles from the store and write to local
files under repo.root. files is a list of (filename, hash)
tuples. Return (success, missing), lists of files successfully
downloaded and those not found in the store. success is a list
of (filename, hash) tuples; missing is a list of filenames that
we could not get. (The detailed error message will already have
been presented to the user, so missing is just supplied as a
summary.)'''
success = []
missing = []
ui = self.ui
at = 0
available = self.exists(set(hash for (_filename, hash) in files))
for filename, hash in files:
ui.progress(
_('getting largefiles'), at, unit='lfile', total=len(files))
at += 1
ui.note(_('getting %s:%s\n') % (filename, hash))
if not available.get(hash):
ui.warn(
_('%s: largefile %s not available from %s\n') %
(filename, hash, util.hidepassword(self.url)))
missing.append(filename)
continue
if self._gethash(filename, hash):
success.append((filename, hash))
else:
missing.append(filename)
ui.progress(_('getting largefiles'), None)
return (success, missing)
示例4: validate_synch_path
def validate_synch_path(path, repo):
'''
Validate the path that must be used to sync operations (pull,
push, outgoing and incoming)
'''
return_path = path
for alias, path_aux in repo.ui.configitems('paths'):
if path == alias:
return_path = path_aux
elif path == util.hidepassword(path_aux):
return_path = path_aux
return return_path
示例5: _getoutgoing
def _getoutgoing(repo, dest, revs):
'''Return the revisions present locally but not in dest'''
ui = repo.ui
url = ui.expandpath(dest or 'default-push', dest or 'default')
url = hg.parseurl(url)[0]
ui.status(_('comparing with %s\n') % util.hidepassword(url))
revs = [r for r in revs if r >= 0]
if not revs:
revs = [len(repo) - 1]
revs = repo.revs('outgoing(%s) and ::%ld', dest or '', revs)
if not revs:
ui.status(_("no changes found\n"))
return revs
示例6: getoutgoing
def getoutgoing(dest, revs):
'''Return the revisions present locally but not in dest'''
dest = ui.expandpath(dest or 'default-push', dest or 'default')
dest, branches = hg.parseurl(dest)
revs, checkout = hg.addbranchrevs(repo, repo, branches, revs)
other = hg.peer(repo, opts, dest)
ui.status(_('comparing with %s\n') % util.hidepassword(dest))
common, _anyinc, _heads = discovery.findcommonincoming(repo, other)
nodes = revs and map(repo.lookup, revs) or revs
o = repo.changelog.findmissing(common, heads=nodes)
if not o:
ui.status(_("no changes found\n"))
return []
return [str(repo.changelog.rev(r)) for r in o]
示例7: pull
def pull():
cmdutil.setremoteconfig(ui, opts)
other = hg.repository(ui, ui.expandpath(source))
ui.status(_('pulling from %s\n') %
util.hidepassword(ui.expandpath(source)))
revs = None
if opts['rev']:
if not other.local():
raise util.Abort(_("fetch -r doesn't work for remote "
"repositories yet"))
else:
revs = [other.lookup(rev) for rev in opts['rev']]
modheads = repo.pull(other, heads=revs)
return postincoming(other, modheads)
示例8: _openstore
def _openstore(repo, remote=None, put=False):
ui = repo.ui
if not remote:
lfpullsource = getattr(repo, 'lfpullsource', None)
if lfpullsource:
path = ui.expandpath(lfpullsource)
elif put:
path = ui.expandpath('default-push', 'default')
else:
path = ui.expandpath('default')
# ui.expandpath() leaves 'default-push' and 'default' alone if
# they cannot be expanded: fallback to the empty string,
# meaning the current directory.
if path == 'default-push' or path == 'default':
path = ''
remote = repo
else:
path, _branches = hg.parseurl(path)
remote = hg.peer(repo, {}, path)
# The path could be a scheme so use Mercurial's normal functionality
# to resolve the scheme to a repository and use its path
path = util.safehasattr(remote, 'url') and remote.url() or remote.path
match = _scheme_re.match(path)
if not match: # regular filesystem path
scheme = 'file'
else:
scheme = match.group(1)
try:
storeproviders = _storeprovider[scheme]
except KeyError:
raise error.Abort(_('unsupported URL scheme %r') % scheme)
for classobj in storeproviders:
try:
return classobj(ui, repo, remote)
except lfutil.storeprotonotcapable:
pass
raise error.Abort(
_('%s does not appear to be a largefile store') %
util.hidepassword(path))
示例9: _getfile
def _getfile(self, tmpfile, filename, hash):
try:
chunks = self._get(hash)
except urlerr.httperror as e:
# 401s get converted to error.Aborts; everything else is fine being
# turned into a StoreError
raise basestore.StoreError(filename, hash, self.url, str(e))
except urlerr.urlerror as e:
# This usually indicates a connection problem, so don't
# keep trying with the other files... they will probably
# all fail too.
raise error.Abort('%s: %s' %
(util.hidepassword(self.url), e.reason))
except IOError as e:
raise basestore.StoreError(filename, hash, self.url, str(e))
return lfutil.copyandhash(chunks, tmpfile)
示例10: findoutgoing
def findoutgoing(ui, repo, remote=None, force=False, opts={}):
"""utility function to find the first outgoing changeset
Used by initialisation code"""
dest = ui.expandpath(remote or 'default-push', remote or 'default')
dest, revs = hg.parseurl(dest, None)[:2]
ui.status(_('comparing with %s\n') % util.hidepassword(dest))
revs, checkout = hg.addbranchrevs(repo, repo, revs, None)
other = hg.peer(repo, opts, dest)
if revs:
revs = [repo.lookup(rev) for rev in revs]
# hexlify nodes from outgoing, because we're going to parse
# parent[0] using revsingle below, and if the binary hash
# contains special revset characters like ":" the revset
# parser can choke.
outgoing = discovery.findcommonoutgoing(repo, other, revs, force=force)
if not outgoing.missing:
raise util.Abort(_('no outgoing ancestors'))
return outgoing.missing[0]
示例11: findoutgoing
def findoutgoing(ui, repo, remote=None, force=False, opts={}):
"""utility function to find the first outgoing changeset
Used by initialisation code"""
dest = ui.expandpath(remote or 'default-push', remote or 'default')
dest, revs = hg.parseurl(dest, None)[:2]
ui.status(_('comparing with %s\n') % util.hidepassword(dest))
revs, checkout = hg.addbranchrevs(repo, repo, revs, None)
other = hg.peer(repo, opts, dest)
if revs:
revs = [repo.lookup(rev) for rev in revs]
outgoing = discovery.findcommonoutgoing(repo, other, revs, force=force)
if not outgoing.missing:
raise util.Abort(_('no outgoing ancestors'))
roots = list(repo.revs("roots(%ln)", outgoing.missing))
if 1 < len(roots):
msg = _('there are ambiguous outgoing revisions')
hint = _('see "hg help histedit" for more detail')
raise util.Abort(msg, hint=hint)
return repo.lookup(roots[0])
示例12: gitgetmeta
def gitgetmeta(ui, repo, source='default'):
'''get git metadata from a server that supports fb_gitmeta'''
source, branch = hg.parseurl(ui.expandpath(source))
other = hg.peer(repo, {}, source)
ui.status(_('getting git metadata from %s\n') %
util.hidepassword(source))
kwargs = {'bundlecaps': exchange.caps20to10(repo)}
capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo))
kwargs['bundlecaps'].add('bundle2=' + util.urlreq.quote(capsblob))
# this would ideally not be in the bundlecaps at all, but adding new kwargs
# for wire transmissions is not possible as of Mercurial d19164a018a1
kwargs['bundlecaps'].add('fb_gitmeta')
kwargs['heads'] = [nullid]
kwargs['cg'] = False
kwargs['common'] = _getcommonheads(repo)
bundle = other.getbundle('pull', **kwargs)
try:
op = bundle2.processbundle(repo, bundle)
except error.BundleValueError as exc:
raise error.Abort('missing support for %s' % exc)
writebytes = op.records['fb:gitmeta:writebytes']
ui.status(_('wrote %d files (%d bytes)\n') %
(len(writebytes), sum(writebytes)))
示例13: __str__
def __str__(self):
return "%s: %s" % (util.hidepassword(self.url), self.detail)
示例14: fetch
def fetch(ui, repo, source="default", **opts):
"""pull changes from a remote repository, merge new changes if needed.
This finds all changes from the repository at the specified path
or URL and adds them to the local repository.
If the pulled changes add a new branch head, the head is
automatically merged, and the result of the merge is committed.
Otherwise, the working directory is updated to include the new
changes.
When a merge occurs, the newly pulled changes are assumed to be
"authoritative". The head of the new changes is used as the first
parent, with local changes as the second. To switch the merge
order, use --switch-parent.
See :hg:`help dates` for a list of formats valid for -d/--date.
Returns 0 on success.
"""
date = opts.get("date")
if date:
opts["date"] = util.parsedate(date)
parent, p2 = repo.dirstate.parents()
branch = repo.dirstate.branch()
branchnode = repo.branchtags().get(branch)
if parent != branchnode:
raise util.Abort(_("working dir not at branch tip " '(use "hg update" to check out branch tip)'))
if p2 != nullid:
raise util.Abort(_("outstanding uncommitted merge"))
wlock = lock = None
try:
wlock = repo.wlock()
lock = repo.lock()
mod, add, rem, del_ = repo.status()[:4]
if mod or add or rem:
raise util.Abort(_("outstanding uncommitted changes"))
if del_:
raise util.Abort(_("working directory is missing some files"))
bheads = repo.branchheads(branch)
bheads = [head for head in bheads if len(repo[head].children()) == 0]
if len(bheads) > 1:
raise util.Abort(_("multiple heads in this branch " '(use "hg heads ." and "hg merge" to merge)'))
other = hg.peer(repo, opts, ui.expandpath(source))
ui.status(_("pulling from %s\n") % util.hidepassword(ui.expandpath(source)))
revs = None
if opts["rev"]:
try:
revs = [other.lookup(rev) for rev in opts["rev"]]
except error.CapabilityError:
err = _("Other repository doesn't support revision lookup, " "so a rev cannot be specified.")
raise util.Abort(err)
# Are there any changes at all?
modheads = repo.pull(other, heads=revs)
if modheads == 0:
return 0
# Is this a simple fast-forward along the current branch?
newheads = repo.branchheads(branch)
newchildren = repo.changelog.nodesbetween([parent], newheads)[2]
if len(newheads) == 1:
if newchildren[0] != parent:
return hg.clean(repo, newchildren[0])
else:
return 0
# Are there more than one additional branch heads?
newchildren = [n for n in newchildren if n != parent]
newparent = parent
if newchildren:
newparent = newchildren[0]
hg.clean(repo, newparent)
newheads = [n for n in newheads if n != newparent]
if len(newheads) > 1:
ui.status(
_("not merging with %d other new branch heads " '(use "hg heads ." and "hg merge" to merge them)\n')
% (len(newheads) - 1)
)
return 1
# Otherwise, let's merge.
err = False
if newheads:
# By default, we consider the repository we're pulling
# *from* as authoritative, so we merge our changes into
# theirs.
if opts["switch_parent"]:
firstparent, secondparent = newparent, newheads[0]
else:
firstparent, secondparent = newheads[0], newparent
ui.status(_("updating to %d:%s\n") % (repo.changelog.rev(firstparent), short(firstparent)))
hg.clean(repo, firstparent)
ui.status(_("merging with %d:%s\n") % (repo.changelog.rev(secondparent), short(secondparent)))
#.........这里部分代码省略.........
示例15: fetch
def fetch(ui, repo, source='default', **opts):
'''pull changes from a remote repository, merge new changes if needed.
This finds all changes from the repository at the specified path
or URL and adds them to the local repository.
If the pulled changes add a new branch head, the head is
automatically merged, and the result of the merge is committed.
Otherwise, the working directory is updated to include the new
changes.
When a merge is needed, the working directory is first updated to
the newly pulled changes. Local changes are then merged into the
pulled changes. To switch the merge order, use --switch-parent.
See :hg:`help dates` for a list of formats valid for -d/--date.
Returns 0 on success.
'''
date = opts.get('date')
if date:
opts['date'] = util.parsedate(date)
parent, _p2 = repo.dirstate.parents()
branch = repo.dirstate.branch()
try:
branchnode = repo.branchtip(branch)
except error.RepoLookupError:
branchnode = None
if parent != branchnode:
raise util.Abort(_('working dir not at branch tip '
'(use "hg update" to check out branch tip)'))
wlock = lock = None
try:
wlock = repo.wlock()
lock = repo.lock()
cmdutil.bailifchanged(repo)
bheads = repo.branchheads(branch)
bheads = [head for head in bheads if len(repo[head].children()) == 0]
if len(bheads) > 1:
raise util.Abort(_('multiple heads in this branch '
'(use "hg heads ." and "hg merge" to merge)'))
other = hg.peer(repo, opts, ui.expandpath(source))
ui.status(_('pulling from %s\n') %
util.hidepassword(ui.expandpath(source)))
revs = None
if opts['rev']:
try:
revs = [other.lookup(rev) for rev in opts['rev']]
except error.CapabilityError:
err = _("other repository doesn't support revision lookup, "
"so a rev cannot be specified.")
raise util.Abort(err)
# Are there any changes at all?
modheads = exchange.pull(repo, other, heads=revs).cgresult
if modheads == 0:
return 0
# Is this a simple fast-forward along the current branch?
newheads = repo.branchheads(branch)
newchildren = repo.changelog.nodesbetween([parent], newheads)[2]
if len(newheads) == 1 and len(newchildren):
if newchildren[0] != parent:
return hg.update(repo, newchildren[0])
else:
return 0
# Are there more than one additional branch heads?
newchildren = [n for n in newchildren if n != parent]
newparent = parent
if newchildren:
newparent = newchildren[0]
hg.clean(repo, newparent)
newheads = [n for n in newheads if n != newparent]
if len(newheads) > 1:
ui.status(_('not merging with %d other new branch heads '
'(use "hg heads ." and "hg merge" to merge them)\n') %
(len(newheads) - 1))
return 1
if not newheads:
return 0
# Otherwise, let's merge.
err = False
if newheads:
# By default, we consider the repository we're pulling
# *from* as authoritative, so we merge our changes into
# theirs.
if opts['switch_parent']:
firstparent, secondparent = newparent, newheads[0]
else:
firstparent, secondparent = newheads[0], newparent
ui.status(_('updating to %d:%s\n') %
#.........这里部分代码省略.........