我如何可以使用水银API,以确定所做的更改库对每一集?我能够得到的文件列表有关的特定修订,但我无法弄清楚该如何告诉发生了什么事文件。

我怎么能回答这些问题有关的各自文件中变更集:

  • 这是加入?
  • 这是删除?
  • 它修正了?

是否有一个属性,在该文件的背景下,会告诉我的这种(如果是这样,我找不到的话),或者有办法弄清楚这一点通过其他手段?

这里是我的代码:

def index(request):
    u = ui.ui()
    repo = hg.repository(ui.ui(), '/path/to/repo')
    changes = repo.changelog
    changesets = []

    for change in changes:
        ctx = repo.changectx(change)
        fileCtxs = []
        for aFile in ctx.files():
            if aFile in ctx:
                for status in repo.status(None, ctx.node()):
                    # I'm hoping this could return A, M, D, ? etc
                    fileCtxs.append(status)

        changeset = {
            'files':ctx.files(),
            'rev':str(ctx.rev()),
            'desc':ctx.description(),
            'user':ctx.user(),
            'filectxs':fileCtxs,
        }
        changesets.append(changeset)

    c = Context({
        'changesets': changesets,
    })

    tmplt = loader.get_template('web/index.html')
    return HttpResponse(tmplt.render(c))
有帮助吗?

解决方案

localrepo.status() 可以采取的情况下作为参数(node1node2).

看看 http://hg.intevation.org/mercurial/crew/file/6505773080e4/mercurial/localrepo.py#l973

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top