• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python util.makedate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

    def __init__(self, patchpath, repo, pf=None, rev=None):
        """ Read patch context from file
        :param pf: currently ignored
            The provided handle is used to read the patch and
            the patchpath contains the name of the patch.
            The handle is NOT closed.
        """
        self._path = patchpath
        if rev:
            assert isinstance(rev, str)
            self._patchname = rev
        else:
            self._patchname = os.path.basename(patchpath)
        self._repo = repo
        self._rev = rev or 'patch'
        self._status = [[], [], []]
        self._fileorder = []
        self._user = ''
        self._desc = ''
        self._branch = ''
        self._node = node.nullid
        self._mtime = None
        self._fsize = 0
        self._parseerror = None
        self._phase = 'draft'

        try:
            self._mtime = os.path.getmtime(patchpath)
            self._fsize = os.path.getsize(patchpath)
            ph = mq.patchheader(self._path)
            self._ph = ph
        except EnvironmentError:
            self._date = util.makedate()
            return

        try:
            self._branch = ph.branch or ''
            self._node = binascii.unhexlify(ph.nodeid)
            if self._repo.ui.configbool('mq', 'secret'):
                self._phase = 'secret'
        except TypeError:
            pass
        except AttributeError:
            # hacks to try to deal with older versions of mq.py
            self._branch = ''
            ph.diffstartline = len(ph.comments)
            if ph.message:
                ph.diffstartline += 1
        except error.ConfigError:
            pass

        self._user = ph.user or ''
        self._desc = ph.message and '\n'.join(ph.message).strip() or ''
        try:
            self._date = ph.date and util.parsedate(ph.date) or util.makedate()
        except error.Abort:
            self._date = util.makedate()
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:57,代码来源:patchctx.py


示例2: chash

def chash(manifest, files, desc, p1, p2, user, date, extra):
    """Compute changeset hash from the changeset pieces."""
    user = user.strip()
    if "\n" in user:
        raise error.RevlogError(_("username %s contains a newline")
                                % repr(user))

    # strip trailing whitespace and leading and trailing empty lines
    desc = '\n'.join([l.rstrip() for l in desc.splitlines()]).strip('\n')

    user, desc = encoding.fromlocal(user), encoding.fromlocal(desc)

    if date:
        parseddate = "%d %d" % util.parsedate(date)
    else:
        parseddate = "%d %d" % util.makedate()
    extra = extra.copy()
    if 'signature' in extra:
        del extra['signature']
    if extra.get("branch") in ("default", ""):
        del extra["branch"]
    if extra:
        extra = changelog.encodeextra(extra)
        parseddate = "%s %s" % (parseddate, extra)
    l = [hex(manifest), user, parseddate] + sorted(files) + ["", desc]
    text = "\n".join(l)
    return revlog.hash(text, p1, p2)
开发者ID:tpoeppke,项目名称:reds,代码行数:27,代码来源:commitsigs.py


示例3: entries

    def entries(sortcolumn="", descending=False, subdir="", **map):
        rows = []
        parity = common.paritygen(stripecount)
        for repo in Repository.objects.has_view_permission(request.user):
            contact = smart_str(repo.owner.get_full_name())

            lastchange = (common.get_mtime(repo.location), util.makedate()[1])
             
            row = dict(contact=contact or "unknown",
                       contact_sort=contact.upper() or "unknown",
                       name=smart_str(repo.name),
                       name_sort=smart_str(repo.name),
                       url=repo.get_absolute_url(),
                       description=smart_str(repo.description) or "unknown",
                       description_sort=smart_str(repo.description.upper()) or "unknown",
                       lastchange=lastchange,
                       lastchange_sort=lastchange[1]-lastchange[0],
                       archives=archivelist(u, "tip", url))
            if (not sortcolumn or (sortcolumn, descending) == sortdefault):
                # fast path for unsorted output
                row['parity'] = parity.next()
                yield row
            else:
                rows.append((row["%s_sort" % sortcolumn], row))

        if rows:
            rows.sort()
            if descending:
                rows.reverse()
            for key, row in rows:
                row['parity'] = parity.next()
                yield row
开发者ID:IanLewis,项目名称:django-hgwebproxy,代码行数:32,代码来源:views.py


示例4: record

    def record(self, namespace, name, oldhashes, newhashes):
        """Record a new journal entry

        * namespace: an opaque string; this can be used to filter on the type
          of recorded entries.
        * name: the name defining this entry; for bookmarks, this is the
          bookmark name. Can be filtered on when retrieving entries.
        * oldhashes and newhashes: each a single binary hash, or a list of
          binary hashes. These represent the old and new position of the named
          item.

        """
        if not isinstance(oldhashes, list):
            oldhashes = [oldhashes]
        if not isinstance(newhashes, list):
            newhashes = [newhashes]

        entry = journalentry(
            util.makedate(), self.user, self.command, namespace, name,
            oldhashes, newhashes)

        vfs = self.vfs
        if self.sharedvfs is not None:
            # write to the shared repository if this feature is being
            # shared between working copies.
            if sharednamespaces.get(namespace) in self.sharedfeatures:
                vfs = self.sharedvfs

        self._write(vfs, entry)
开发者ID:motlin,项目名称:cyg,代码行数:29,代码来源:journal.py


示例5: template_pushheaddates

def template_pushheaddates(repo, ctx, **args):
    """:pushheaddates: List of date information. The dates this changeset
    was pushed to various trees as a push head."""
    node = ctx.node()
    pushes = repo.changetracker.pushes_for_changeset(ctx.node())

    return [util.makedate(p[2]) for p in pushes if str(p[4]) == node]
开发者ID:armenzg,项目名称:version-control-tools,代码行数:7,代码来源:__init__.py


示例6: filelog

def filelog(orig, web, req, tmpl):
    """Wraps webcommands.filelog to provide pushlog metadata to template."""

    if hasattr(web.repo, 'pushlog'):

        class _tmpl(object):

            def __init__(self):
                self.defaults = tmpl.defaults

            def __call__(self, *args, **kwargs):
                self.args = args
                self.kwargs = kwargs
                return self

        class _ctx(object):

            def __init__(self, hex):
                self._hex = hex

            def hex(self):
                return self._hex

        t = orig(web, req, _tmpl())
        for entry in t.kwargs['entries']:
            pushinfo = web.repo.pushlog.pushfromchangeset(_ctx(entry['node']))
            entry['pushid'] = pushinfo[0]
            entry['pushdate'] = util.makedate(pushinfo[2])

        return tmpl(*t.args, **t.kwargs)
    else:
        return orig(web, req, tmpl)
开发者ID:pkdevboxy,项目名称:version-control-tools,代码行数:32,代码来源:__init__.py


示例7: maxWidthValueForColumn

 def maxWidthValueForColumn(self, col):
     if self.graph is None:
         return 'XXXX'
     column = self._columns[col]
     if column == 'Rev':
         return '8' * len(str(len(self.repo))) + '+'
     if column == 'Node':
         return '8' * 12 + '+'
     if column in ('LocalTime', 'UTCTime'):
         return hglib.displaytime(util.makedate())
     if column in ('Tags', 'Latest tags'):
         try:
             return sorted(self.repo.tags().keys(), key=lambda x: len(x))[-1][:10]
         except IndexError:
             pass
     if column == 'Branch':
         try:
             return sorted(self.repo.branchtags().keys(), key=lambda x: len(x))[-1]
         except IndexError:
             pass
     if column == 'Filename':
         return self.filename
     if column == 'Graph':
         res = self.col2x(self.graph.max_cols)
         return min(res, 150)
     if column == 'Changes':
         return 'Changes'
     # Fall through for Description
     return None
开发者ID:velorientc,项目名称:git_test7,代码行数:29,代码来源:repomodel.py


示例8: setupheaderopts

def setupheaderopts(ui, opts):
    """sets the user and date; copied from mq"""
    def do(opt, val):
        if not opts.get(opt) and opts.get('current' + opt):
            opts[opt] = val
    do('user', ui.username())
    do('date', '%d %d' % util.makedate())
开发者ID:axtl,项目名称:dotfiles,代码行数:7,代码来源:attic.py


示例9: makepatch

def makepatch(ui, repo, name=None, pats=[], opts={}):
    """sets up the call for attic.createpatch and makes the call"""
    s = repo.attic
    force = opts.get('force')
    if name and s.exists(name) and name != s.applied and not force:
        raise util.Abort(_('attempting to overwrite existing patch'))
    if name and s.applied and name != s.applied and not force:
        raise util.Abort(_('a different patch is active'))
    if not name:
        name = s.applied
    if not name:
        raise util.Abort(_('you need to supply a patch name'))

    date, user, message = None, None, ''
    if s.applied:
        data = patch.extract(ui, open(s.join(s.applied), 'r'))
        tmpname, message, user, date, branch, nodeid, p1, p2 = data
        os.unlink(tmpname)
    msg = cmdutil.logmessage(opts)
    if not msg:
        msg = message
    if opts.get('edit'):
        msg = ui.edit(msg, ui.username())
    setupheaderopts(ui, opts)
    if opts.get('user'):
        user=opts['user']
    if not user:
        user = ui.username()
    if opts.get('date'):
        date=opts['date']
    if not date:
        date = util.makedate()
    date = util.parsedate(date)
    s.createpatch(repo, name, msg, user, date, pats, opts)
开发者ID:axtl,项目名称:dotfiles,代码行数:34,代码来源:attic.py


示例10: template_firstpushdate

def template_firstpushdate(repo, ctx, **args):
    """:firstpushdate: Date information. The date of the first push of this
    changeset."""
    pushes = list(repo.changetracker.pushes_for_changeset(ctx.node()))
    if not pushes:
        return None

    return util.makedate(pushes[0][2])
开发者ID:armenzg,项目名称:version-control-tools,代码行数:8,代码来源:__init__.py


示例11: rawentries

        def rawentries(subdir="", **map):

            descend = self.ui.configbool('web', 'descend', True)
            for name, path in self.repos:

                if not name.startswith(subdir):
                    continue
                name = name[len(subdir):]
                if not descend and '/' in name:
                    continue

                u = self.ui.copy()
                try:
                    u.readconfig(os.path.join(path, '.hg', 'hgrc'))
                except Exception, e:
                    u.warn(_('error reading %s/.hg/hgrc: %s\n') % (path, e))
                    continue
                def get(section, name, default=None):
                    return u.config(section, name, default, untrusted=True)

                if u.configbool("web", "hidden", untrusted=True):
                    continue

                if not self.read_allowed(u, req):
                    continue

                parts = [name]
                if 'PATH_INFO' in req.env:
                    parts.insert(0, req.env['PATH_INFO'].rstrip('/'))
                if req.env['SCRIPT_NAME']:
                    parts.insert(0, req.env['SCRIPT_NAME'])
                url = re.sub(r'/+', '/', '/'.join(parts) + '/')

                # update time with local timezone
                try:
                    r = hg.repository(self.ui, path)
                except error.RepoError:
                    u.warn(_('error accessing repository at %s\n') % path)
                    continue
                try:
                    d = (get_mtime(r.spath), util.makedate()[1])
                except OSError:
                    continue

                contact = get_contact(get)
                description = get("web", "description", "")
                name = get("web", "name", name)
                row = dict(contact=contact or "unknown",
                           contact_sort=contact.upper() or "unknown",
                           name=name,
                           name_sort=name,
                           url=url,
                           description=description or "unknown",
                           description_sort=description.upper() or "unknown",
                           lastchange=d,
                           lastchange_sort=d[1]-d[0],
                           archives=archivelist(u, "tip", url))
                yield row
开发者ID:MezzLabs,项目名称:mercurial,代码行数:58,代码来源:hgwebdir_mod.py


示例12: entries

        def entries(sortcolumn="", descending=False, subdir="", **map):
            rows = []
            parity = paritygen(self.stripecount)
            for name, path in self.repos:
                if not name.startswith(subdir):
                    continue
                name = name[len(subdir):]

                u = self.ui.copy()
                try:
                    u.readconfig(os.path.join(path, '.hg', 'hgrc'))
                except Exception, e:
                    u.warn(_('error reading %s/.hg/hgrc: %s\n') % (path, e))
                    continue
                def get(section, name, default=None):
                    return u.config(section, name, default, untrusted=True)

                if u.configbool("web", "hidden", untrusted=True):
                    continue

                if not self.read_allowed(u, req):
                    continue

                parts = [name]
                if 'PATH_INFO' in req.env:
                    parts.insert(0, req.env['PATH_INFO'].rstrip('/'))
                if req.env['SCRIPT_NAME']:
                    parts.insert(0, req.env['SCRIPT_NAME'])
                m = re.match('((?:https?://)?)(.*)', '/'.join(parts))
                # squish repeated slashes out of the path component
                url = m.group(1) + re.sub('/+', '/', m.group(2)) + '/'

                # update time with local timezone
                try:
                    d = (get_mtime(path), util.makedate()[1])
                except OSError:
                    continue

                contact = get_contact(get)
                description = get("web", "description", "")
                name = get("web", "name", name)
                row = dict(contact=contact or "unknown",
                           contact_sort=contact.upper() or "unknown",
                           name=name,
                           name_sort=name,
                           url=url,
                           description=description or "unknown",
                           description_sort=description.upper() or "unknown",
                           lastchange=d,
                           lastchange_sort=d[1]-d[0],
                           archives=archivelist(u, "tip", url))
                if (not sortcolumn or (sortcolumn, descending) == sortdefault):
                    # fast path for unsorted output
                    row['parity'] = parity.next()
                    yield row
                else:
                    rows.append((row["%s_sort" % sortcolumn], row))
开发者ID:Nurb432,项目名称:plan9front,代码行数:57,代码来源:hgwebdir_mod.py


示例13: addpushmetadata

def addpushmetadata(repo, ctx, d):
    if not hasattr(repo, 'pushlog'):
        return

    pushinfo = repo.pushlog.pushfromchangeset(ctx)
    if pushinfo:
        d['pushid'] = pushinfo[0]
        d['pushuser'] = pushinfo[1]
        d['pushdate'] = util.makedate(pushinfo[2])
        d['pushnodes'] = pushinfo[3]
        d['pushhead'] = pushinfo[3][-1]
开发者ID:pombredanne,项目名称:version-control-tools,代码行数:11,代码来源:__init__.py


示例14: timetravel

def timetravel(ui, repo):
    "Change date of commit."

    ctx = repo[None].p1()
    while ctx.phase():
        ctx = ctx.p1()

    parent = ctx
    date = util.makedate()
    update_node, strip_nodes = copy_branch(repo, ctx, parent, date)
    if update_node:
        hg.update(repo, update_node)
    if strip_nodes:
        repair.strip(ui, repo, strip_nodes)
开发者ID:jdufresne,项目名称:timetravel,代码行数:14,代码来源:timetravel.py


示例15: listcmd

def listcmd(ui, repo, pats, opts):
    """subcommand that displays the list of shelves"""
    pats = set(pats)
    width = 80
    if not ui.plain():
        width = ui.termwidth()
    namelabel = 'shelve.newest'
    for mtime, name in listshelves(repo):
        sname = util.split(name)[1]
        if pats and sname not in pats:
            continue
        ui.write(sname, label=namelabel)
        namelabel = 'shelve.name'
        if ui.quiet:
            ui.write('\n')
            continue
        ui.write(' ' * (16 - len(sname)))
        used = 16
        age = '(%s)' % templatefilters.age(util.makedate(mtime), abbrev=True)
        ui.write(age, label='shelve.age')
        ui.write(' ' * (12 - len(age)))
        used += 12
        fp = open(name + '.patch', 'rb')
        try:
            while True:
                line = fp.readline()
                if not line:
                    break
                if not line.startswith('#'):
                    desc = line.rstrip()
                    if ui.formatted():
                        desc = util.ellipsis(desc, width - used)
                    ui.write(desc)
                    break
            ui.write('\n')
            if not (opts['patch'] or opts['stat']):
                continue
            difflines = fp.readlines()
            if opts['patch']:
                for chunk, label in patch.difflabel(iter, difflines):
                    ui.write(chunk, label=label)
            if opts['stat']:
                for chunk, label in patch.diffstatui(difflines, width=width,
                                                     git=True):
                    ui.write(chunk, label=label)
        finally:
            fp.close()
开发者ID:roopakparikh,项目名称:crane-node-hello,代码行数:47,代码来源:shelve.py


示例16: __init__

    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.setWindowFlags(Qt.Window)
        self.setWindowIcon(qtlib.geticon("fileadd"))
        self.setWindowTitle(_('New Patch Branch'))

        def AddField(var, label, optional=False):
            hbox = QHBoxLayout()
            SP = QSizePolicy
            le = QLineEdit()
            le.setSizePolicy(SP(SP.Expanding, SP.Fixed))
            if optional:
                cb = QCheckBox(label)
                le.setEnabled(False)
                cb.toggled.connect(le.setEnabled)
                hbox.addWidget(cb)
                setattr(self, var+'cb', cb)
            else:
                hbox.addWidget(QLabel(label))
            hbox.addWidget(le)
            setattr(self, var+'le', le)
            return hbox

        def DialogButtons():
            BB = QDialogButtonBox
            bb = QDialogButtonBox(BB.Ok|BB.Cancel)
            bb.accepted.connect(self.accept)
            bb.rejected.connect(self.reject)
            bb.button(BB.Ok).setDefault(True)
            bb.button(BB.Cancel).setDefault(False)
            self.commitButton = bb.button(BB.Ok)
            self.commitButton.setText(_('Commit', 'action button'))
            self.bb = bb
            return bb

        layout = QVBoxLayout()
        layout.setContentsMargins(2, 2, 2, 2)
        self.setLayout(layout)
        layout.addLayout(AddField('patchname',_('Patch name:')))
        layout.addLayout(AddField('patchtext',_('Patch message:'), optional=True))
        layout.addLayout(AddField('patchdate',_('Patch date:'), optional=True))
        layout.addLayout(AddField('patchuser',_('Patch user:'), optional=True))
        layout.addWidget(DialogButtons())

        self.patchdatele.setText(
                hglib.tounicode(hglib.displaytime(util.makedate())))
开发者ID:velorientc,项目名称:git_test7,代码行数:46,代码来源:pbranch.py


示例17: _obsstorecreate

def _obsstorecreate(orig, self, tr, prec, succs=(), flag=0, parents=None,
                    date=None, metadata=None, ui=None):
    # make "prec in succs" in-marker cycle check a no-op
    succs = _nocontainslist(succs)
    # we need to resolve default date
    if date is None:
        if ui is not None:
            date = ui.configdate('devel', 'default-date')
        if date is None:
            date = util.makedate()
    # if prec is a successor of an existing marker, make default date bigger so
    # the old marker won't revive the predecessor accidentally. This helps tests
    # where date are always (0, 0)
    markers = self.predecessors.get(prec)
    if markers:
        maxdate = max(m[4] for m in markers)
        maxdate = (maxdate[0] + 1, maxdate[1])
        if maxdate > date:
            date = maxdate
    return orig(self, tr, prec, succs, flag, parents, date, metadata, ui)
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:20,代码来源:inhibit.py


示例18: maxWidthValueForColumn

 def maxWidthValueForColumn(self, column):
     if column == RevColumn:
         return '8' * len(str(len(self.repo))) + '+'
     if column == NodeColumn:
         return '8' * 12 + '+'
     if column in (LocalDateColumn, UtcDateColumn):
         return hglib.displaytime(util.makedate())
     if column in (TagsColumn, LatestTagColumn):
         try:
             return sorted(self.repo.tags().keys(), key=lambda x: len(x))[-1][:10]
         except IndexError:
             pass
     if column == BranchColumn:
         try:
             return sorted(self.repo.branchmap(), key=lambda x: len(x))[-1]
         except IndexError:
             pass
     if column == FileColumn:
         return self._filename
     if column == ChangesColumn:
         return 'Changes'
     # Fall through for DescColumn
     return None
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:23,代码来源:repomodel.py


示例19: patchbomb


#.........这里部分代码省略.........
    if not (opts.get('test') or opts.get('mbox')):
        # really sending
        mail.validateconfig(ui)

    if not (revs or opts.get('rev')
            or opts.get('outgoing') or opts.get('bundle')
            or opts.get('patches')):
        raise util.Abort(_('specify at least one changeset with -r or -o'))

    if opts.get('outgoing') and opts.get('bundle'):
        raise util.Abort(_("--outgoing mode always on with --bundle;"
                           " do not re-specify --outgoing"))

    if opts.get('outgoing') or opts.get('bundle'):
        if len(revs) > 1:
            raise util.Abort(_("too many destinations"))
        dest = revs and revs[0] or None
        revs = []

    if opts.get('rev'):
        if revs:
            raise util.Abort(_('use only one form to specify the revision'))
        revs = opts.get('rev')

    if opts.get('outgoing'):
        revs = outgoing(dest, opts.get('rev'))
    if opts.get('bundle'):
        opts['revs'] = revs

    # start
    if opts.get('date'):
        start_time = util.parsedate(opts.get('date'))
    else:
        start_time = util.makedate()

    def genmsgid(id):
        return '<%s.%[email protected]%s>' % (id[:20], int(start_time[0]), socket.getfqdn())

    def getdescription(body, sender):
        if opts.get('desc'):
            body = open(opts.get('desc')).read()
        else:
            ui.write(_('\nWrite the introductory message for the '
                       'patch series.\n\n'))
            body = ui.edit(body, sender)
        return body

    def getpatchmsgs(patches, patchnames=None):
        jumbo = []
        msgs = []

        ui.write(_('This patch series consists of %d patches.\n\n')
                 % len(patches))

        name = None
        for i, p in enumerate(patches):
            jumbo.extend(p)
            if patchnames:
                name = patchnames[i]
            msg = makepatch(ui, repo, p, opts, _charsets, i + 1,
                            len(patches), name)
            msgs.append(msg)

        if len(patches) > 1 or opts.get('intro'):
            tlen = len(str(len(patches)))
开发者ID:Frostman,项目名称:intellij-community,代码行数:66,代码来源:patchbomb.py


示例20: template_pushdate

def template_pushdate(repo, ctx, templ, cache, **args):
    """:pushdate: Date information. When this changeset was pushed."""
    pushid, who, when, nodes = _getpushinfo(repo, ctx, cache)
    return util.makedate(when) if when else None
开发者ID:pombredanne,项目名称:version-control-tools,代码行数:4,代码来源:__init__.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.makedirs函数代码示例发布时间:2022-05-27
下一篇:
Python util.hidepassword函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap