5

Mercurial 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))
4

1 に答える 1

5

localrepo.status()コンテキストを引数として取ることができます ( node1and node2)。

http://hg.intevation.org/mercurial/crew/file/6505773080e4/mercurial/localrepo.py#l973を参照してください。

于 2010-02-28T18:51:13.373 に答える