当前位置: 首页>>代码示例>>Python>>正文


Python node.short函数代码示例

本文整理汇总了Python中mercurial.node.short函数的典型用法代码示例。如果您正苦于以下问题:Python short函数的具体用法?Python short怎么用?Python short使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了short函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: hook

def hook(ui, repo, node, hooktype, **kwargs):
    repo_name = os.path.basename(repo.root)
    if repo_name not in hgNameToRevURL:
        return 0

    # All changesets from node to "tip" inclusive are part of this push.
    rev = repo.changectx(node).rev()
    tip = repo.changectx('tip').rev()

    num_changes = tip + 1 - rev
    url = 'https://hg.mozilla.org/' + hgNameToRevURL[repo_name]

    if num_changes <= 10:
        plural = 's' if num_changes > 1 else ''
        print 'You can view your change%s at the following URL%s:' % (plural, plural)

        for i in xrange(rev, tip + 1):
            node = short(repo.changectx(i).node())
            print '  %srev/%s' % (url, node)
    else:
        tip_node = short(repo.changectx(tip).node())
        print 'You can view the pushlog for your changes at the following URL:'
        print '  %spushloghtml?changeset=%s' % (url, tip_node)

    # For try repositories, also output a results dashboard url.
    if repo_name in ['try', 'try-comm-central']:
        tip_node = short(repo.changectx(tip).node())
        # TBPL uses alternative names that don't match buildbot or hg.
        tbpl_name = 'Thunderbird-Try' if repo_name == 'try-comm-central' else 'Try'
        print 'You can view the progress of your build at the following URL:'
        print '  https://treeherder.mozilla.org/#/jobs?repo=%s&revision=%s' % (repo_name, tip_node)
        print 'Alternatively, view them on TBPL (soon to be deprecated):'
        print '  https://tbpl.mozilla.org/?tree=%s&rev=%s' % (tbpl_name, tip_node)

    return 0
开发者ID:simar7,项目名称:git-version-control-tools-clone,代码行数:35,代码来源:push_printurls.py

示例2: snapshot

def snapshot(ui, repo, files, node, tmproot, listsubrepos):
  """snapshot files as of some revision

    if not using snapshot, -I/-X does not work and recursive diff
    in tools like kdiff3 and meld displays too many files.
  """
  dirname = os.path.basename(repo.root)
  if dirname == '':
    dirname = 'root'
  if node is not None:
    dirname = '%s.%s' % (dirname, short(node))
  base = os.path.join(tmproot, dirname)
  os.mkdir(base)

  if node is not None:
    ui.note(_('making snapshot of %d files from rev %s\n') %
            (len(files), short(node)))
  else:
    ui.note(_('making snapshot of %d files from working directory\n') %
            (len(files)))

  if files:
    repo.ui.setconfig('ui', 'archivemeta', False)

    archival.archive(
        repo,
        base,
        node,
        'files',
        match=scmutil.matchfiles(repo, files),
        subrepos=listsubrepos)

  return dirname
开发者ID:bukzor,项目名称:dotfiles,代码行数:33,代码来源:extdiff2.py

示例3: recover

    def recover(self, repo, source, opts):
        """commit working directory using journal metadata"""
        node, user, date, message, parents = self.readlog()
        merge = False

        if not user or not date or not message or not parents[0]:
            raise util.Abort(_("transplant log file is corrupt"))

        parent = parents[0]
        if len(parents) > 1:
            if opts.get("parent"):
                parent = source.lookup(opts["parent"])
                if parent not in parents:
                    raise util.Abort(_("%s is not a parent of %s") % (short(parent), short(node)))
            else:
                merge = True

        extra = {"transplant_source": node}
        wlock = repo.wlock()
        try:
            p1, p2 = repo.dirstate.parents()
            if p1 != parent:
                raise util.Abort(_("working dir not at transplant parent %s") % revlog.hex(parent))
            if merge:
                repo.setparents(p1, parents[1])
            n = repo.commit(message, user, date, extra=extra, editor=self.editor)
            if not n:
                raise util.Abort(_("commit failed"))
            if not merge:
                self.transplants.set(n, node)
            self.unlog()

            return n, node
        finally:
            wlock.release()
开发者ID:influencia0406,项目名称:intellij-community,代码行数:35,代码来源:transplant.py

示例4: startfrom

def startfrom(ui, repo, opts):
    base, dest = 'null', 'tip'
    if opts.get('bookmark'):
        dest = opts.get('bookmark')
    if opts.get('base'):
        base = opts['base']
        if opts.get('bookmark') not in repo:
            dest = base

    basectx = scmutil.revsingle(repo, base)
    destctx = scmutil.revsingle(repo, dest)
    ctx = list(repo.set("""
        last(
          %n::%n and (
             extra(p4changelist) or
             extra(p4fullimportbasechangelist)))""",
             basectx.node(), destctx.node()))
    if ctx:
        ctx = ctx[0]
        startcl = lastcl(ctx)
        ui.note(_('incremental import from changelist: %d, node: %s\n') %
                (startcl, short(ctx.node())))
        if ctx.node() == basectx.node():
            ui.note(_('creating branchpoint, base %s\n') %
                    short(basectx.node()))
            return ctx, startcl, True
        return ctx, startcl, False
    raise error.Abort(_('no valid p4 changelist number.'))
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:28,代码来源:__init__.py

示例5: rhsummary

def rhsummary(ui, repo, **opts):
    """output the summary of the repository"""
    # see mercurial/commands.py:tip
    ui.write(':tip: rev node\n')
    tipctx = repo[len(repo) - 1]
    ui.write('%d %s\n' % (tipctx.rev(), tipctx))

    # see mercurial/commands.py:root
    ui.write(':root: path\n')
    ui.write(repo.root + '\n')

    # see mercurial/commands.py:tags
    ui.write(':tags: rev node name\n')
    for t, n in reversed(repo.tagslist()):
        if t in SPECIAL_TAGS:
            continue
        try:
            r = repo.changelog.rev(n)
        except error.LookupError:
            r = -1
        ui.write('%d %s %s\n' % (r, node.short(n), t))

    # see mercurial/commands.py:branches
    def iterbranches():
        for t, n in repo.branchtags().iteritems():
            yield t, n, repo.changelog.rev(n)

    ui.write(':branches: rev node name\n')
    for t, n, r in sorted(iterbranches(), key=lambda e: e[2], reverse=True):
        if repo.lookup(r) in repo.branchheads(t, closed=False):
            ui.write('%d %s %s\n' % (r, node.short(n), t))  # only open branch
开发者ID:cannam,项目名称:soundsoftware-site,代码行数:31,代码来源:redminehelper.py

示例6: _sanitycheck

def _sanitycheck(ui, nodes, bases):
    """
    Does some basic sanity checking on a packfiles with ``nodes`` ``bases`` (a
    mapping of node->base):

    - Each deltabase must itself be a node elsewhere in the pack
    - There must be no cycles
    """
    failures = 0
    for node in nodes:
        seen = set()
        current = node
        deltabase = bases[current]

        while deltabase != nullid:
            if deltabase not in nodes:
                ui.warn(("Bad entry: %s has an unknown deltabase (%s)\n" %
                        (short(node), short(deltabase))))
                failures += 1
                break

            if deltabase in seen:
                ui.warn(("Bad entry: %s has a cycle (at %s)\n" %
                        (short(node), short(deltabase))))
                failures += 1
                break

            current = deltabase
            seen.add(current)
            deltabase = bases[current]
        # Since ``node`` begins a valid chain, reset/memoize its base to nullid
        # so we don't traverse it again.
        bases[node] = nullid
    return failures
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:34,代码来源:debugcommands.py

示例7: movebookmarks

def movebookmarks(ui, repo, mapping, oldtopmost, newtopmost):
    """Move bookmark from old to newly created node"""
    if not mapping:
        # if nothing got rewritten there is not purpose for this function
        return
    moves = []
    for bk, old in sorted(repo._bookmarks.iteritems()):
        if old == oldtopmost:
            # special case ensure bookmark stay on tip.
            #
            # This is arguably a feature and we may only want that for the
            # active bookmark. But the behavior is kept compatible with the old
            # version for now.
            moves.append((bk, newtopmost))
            continue
        base = old
        new = mapping.get(base, None)
        if new is None:
            continue
        while not new:
            # base is killed, trying with parent
            base = repo[base].p1().node()
            new = mapping.get(base, (base,))
            # nothing to move
        moves.append((bk, new[-1]))
    if moves:
        marks = repo._bookmarks
        for mark, new in moves:
            old = marks[mark]
            ui.note(_('histedit: moving bookmarks %s from %s to %s\n')
                    % (mark, node.short(old), node.short(new)))
            marks[mark] = new
        marks.write()
开发者ID:RayFerr000,项目名称:PLTL,代码行数:33,代码来源:histedit.py

示例8: filter_cset_known_bug_ids

 def filter_cset_known_bug_ids(self, node, ids):
     for id in sorted(ids):
         if self.get_bug_comments(id).find(short(node)) != -1:
             self.ui.status(_('bug %d already knows about changeset %s\n') %
                            (id, short(node)))
             ids.discard(id)
     return ids
开发者ID:sandeepprasanna,项目名称:ODOO,代码行数:7,代码来源:bugzilla.py

示例9: catcommit

def catcommit(ui, repo, n, prefix, ctx=None):
    nlprefix = '\n' + prefix;
    if ctx is None:
        ctx = repo.changectx(n)
    (p1, p2) = ctx.parents()
    ui.write("tree %s\n" % short(ctx.changeset()[0])) # use ctx.node() instead ??
    if p1: ui.write("parent %s\n" % short(p1.node()))
    if p2: ui.write("parent %s\n" % short(p2.node()))
    date = ctx.date()
    description = ctx.description().replace("\0", "")
    lines = description.splitlines()
    if lines and lines[-1].startswith('committer:'):
        committer = lines[-1].split(': ')[1].rstrip()
    else:
        committer = ctx.user()

    ui.write("author %s %s %s\n" % (ctx.user(), int(date[0]), date[1]))
    ui.write("committer %s %s %s\n" % (committer, int(date[0]), date[1]))
    ui.write("revision %d\n" % ctx.rev())
    ui.write("branch %s\n\n" % ctx.branch())

    if prefix != "":
        ui.write("%s%s\n" % (prefix, description.replace('\n', nlprefix).strip()))
    else:
        ui.write(description + "\n")
    if prefix:
        ui.write('\0')
开发者ID:c0ns0le,项目名称:cygwin,代码行数:27,代码来源:hgk.py

示例10: _printupdatednode

def _printupdatednode(repo, oldnode, newnodes):
    # oldnode was not updated if newnodes is an iterable
    if len(newnodes) == 1:
        newnode = newnodes[0]
        firstline = encoding.trim(
            repo[newnode].description().split("\n")[0], 50, '...')
        repo.ui.status(_("%s -> %s \"%s\"\n") % (
            short(oldnode), short(newnode), firstline))
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:8,代码来源:tweakdefaults.py

示例11: filter_cset_known_bug_ids

 def filter_cset_known_bug_ids(self, node, bugs):
     '''filter bug ids that already refer to this changeset from set.'''
     self.run('''select bug_id from longdescs where
                 bug_id in %s and thetext like "%%%s%%"''' %
              (bzmysql.sql_buglist(bugs.keys()), short(node)))
     for (id,) in self.cursor.fetchall():
         self.ui.status(_('bug %d already knows about changeset %s\n') %
                        (id, short(node)))
         del bugs[id]
开发者ID:32bitfloat,项目名称:intellij-community,代码行数:9,代码来源:bugzilla.py

示例12: send

    def send(self, node, count, data):
        '''send message.'''

        p = email.Parser.Parser()
        msg = p.parsestr(data)

        def fix_subject():
            '''try to make subject line exist and be useful.'''

            subject = msg['Subject']
            if not subject:
                if count > 1:
                    subject = _('%s: %d new changesets') % (self.root, count)
                else:
                    changes = self.repo.changelog.read(node)
                    s = changes[4].lstrip().split('\n', 1)[0].rstrip()
                    subject = '%s: %s' % (self.root, s)
            maxsubject = int(self.ui.config('notify', 'maxsubject', 67))
            if maxsubject and len(subject) > maxsubject:
                subject = subject[:maxsubject-3] + '...'
            del msg['Subject']
            msg['Subject'] = subject

        def fix_sender():
            '''try to make message have proper sender.'''

            sender = msg['From']
            if not sender:
                sender = self.ui.config('email', 'from') or self.ui.username()
            if '@' not in sender or '@localhost' in sender:
                sender = self.fixmail(sender)
            del msg['From']
            msg['From'] = sender

        msg['Date'] = util.datestr(format="%a, %d %b %Y %H:%M:%S %1%2")
        fix_subject()
        fix_sender()

        msg['X-Hg-Notification'] = 'changeset ' + short(node)
        if not msg['Message-Id']:
            msg['Message-Id'] = ('<hg.%s.%s.%[email protected]%s>' %
                                 (short(node), int(time.time()),
                                  hash(self.repo.root), socket.getfqdn()))
        msg['To'] = ', '.join(self.subs)

        msgtext = msg.as_string(0)
        if self.ui.configbool('notify', 'test', True):
            self.ui.write(msgtext)
            if not msgtext.endswith('\n'):
                self.ui.write('\n')
        else:
            self.ui.status(_('notify: sending %d subscribers %d changes\n') %
                           (len(self.subs), count))
            mail.sendmail(self.ui, util.email(msg['From']),
                          self.subs, msgtext)
开发者ID:carlgao,项目名称:lenga,代码行数:55,代码来源:notify.py

示例13: filter_unknown_bug_ids

    def filter_unknown_bug_ids(self, node, ids):
        '''filter bug ids from list that already refer to this changeset.'''

        self.run('''select bug_id from longdescs where
                    bug_id in %s and thetext like "%%%s%%"''' %
                 (buglist(ids), short(node)))
        unknown = set(ids)
        for (id,) in self.cursor.fetchall():
            self.ui.status(_('bug %d already knows about changeset %s\n') %
                           (id, short(node)))
            unknown.discard(id)
        return sorted(unknown)
开发者ID:Nurb432,项目名称:plan9front,代码行数:12,代码来源:bugzilla.py

示例14: applyone

    def applyone(self, repo, node, cl, patchfile, merge=False, log=False,
                 filter=None):
        '''apply the patch in patchfile to the repository as a transplant'''
        (manifest, user, (time, timezone), files, message) = cl[:5]
        date = "%d %d" % (time, timezone)
        extra = {'transplant_source': node}
        if filter:
            (user, date, message) = self.filter(filter, node, cl, patchfile)

        if log:
            # we don't translate messages inserted into commits
            message += '\n(transplanted from %s)' % nodemod.hex(node)

        self.ui.status(_('applying %s\n') % nodemod.short(node))
        self.ui.note('%s %s\n%s\n' % (user, date, message))

        if not patchfile and not merge:
            raise error.Abort(_('can only omit patchfile if merging'))
        if patchfile:
            try:
                files = set()
                patch.patch(self.ui, repo, patchfile, files=files, eolmode=None)
                files = list(files)
            except Exception as inst:
                seriespath = os.path.join(self.path, 'series')
                if os.path.exists(seriespath):
                    os.unlink(seriespath)
                p1 = repo.dirstate.p1()
                p2 = node
                self.log(user, date, message, p1, p2, merge=merge)
                self.ui.write(str(inst) + '\n')
                raise TransplantError(_('fix up the working directory and run '
                                        'hg transplant --continue'))
        else:
            files = None
        if merge:
            p1, p2 = repo.dirstate.parents()
            repo.setparents(p1, node)
            m = match.always(repo.root, '')
        else:
            m = match.exact(repo.root, '', files)

        n = repo.commit(message, user, date, extra=extra, match=m,
                        editor=self.getcommiteditor())
        if not n:
            self.ui.warn(_('skipping emptied changeset %s\n') %
                           nodemod.short(node))
            return None
        if not merge:
            self.transplants.set(n, node)

        return n
开发者ID:motlin,项目名称:cyg,代码行数:52,代码来源:transplant.py

示例15: hook

def hook(ui, repo, node, hooktype, source=None, **kwargs):
    if source in ('pull', 'strip'):
        return 0

    root = ui.config('hgmo', 'repo_root', '/repo/hg/mozilla')

    if not repo.root.startswith(root):
        return 0

    repo_name = repo.root[len(root) + 1:]

    # All changesets from node to "tip" inclusive are part of this push.
    rev = repo.changectx(node).rev()
    tip = repo.changectx('tip').rev()
    tip_node = short(repo.changectx(tip).node())

    num_changes = tip + 1 - rev
    url = 'https://hg.mozilla.org/%s/' % repo_name

    if num_changes <= 10:
        plural = 's' if num_changes > 1 else ''
        print '\nView your change%s here:' % plural

        for i in xrange(rev, tip + 1):
            node = short(repo.changectx(i).node())
            print '  %srev/%s' % (url, node)
    else:
        print '\nView the pushlog for these changes here:'
        print '  %spushloghtml?changeset=%s' % (url, tip_node)

    # For repositories that report CI results to Treeherder, also output a
    # Treeherder url.
    treeherder_repo = ui.config('mozilla', 'treeherder_repo')
    if treeherder_repo:
        treeherder_base_url = 'https://treeherder.mozilla.org'
        print '\nFollow the progress of your build on Treeherder:'
        print '  %s/#/jobs?repo=%s&revision=%s' % (treeherder_base_url,
                                                   treeherder_repo,
                                                   tip_node)
        # if specifying a try build and talos jobs are enabled, suggest that
        # user use compareperf
        if treeherder_repo == 'try':
            msg = repo.changectx(tip).description()
            if ((' -t ' in msg or ' --talos ' in msg) and '-t none' not in msg
                and '--talos none' not in msg):
                print ('\nIt looks like this try push has talos jobs. Compare '
                       'performance against a baseline revision:')
                print ('  %s/perf.html#/comparechooser'
                       '?newProject=try&newRevision=%s' % (
                           treeherder_base_url, tip_node))
    return 0
开发者ID:Nephyrin,项目名称:bzexport,代码行数:51,代码来源:push_printurls.py


注:本文中的mercurial.node.short函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。