Mercurial API ctx.files() doesn't work in merge

5 views
Skip to first unread message

nemo

unread,
Jan 17, 2012, 10:10:26 PM1/17/12
to merc...@selenic.com
Hi

I want to display all the changed files and their status in a changeset,
like this

for f in ctx.files():
for p in ctx.parents():
status = f not in p and 'added'
status = status or (f in ctx and 'modified' or 'removed')
files.append({'status': status, 'node': node, 'filename': f,})

But it seems doesn't work for merge changeset, ctx.files() returns empty
list when ctx is a merge changset.

How can I display the changed files for merge changeset ?

Thanks
_______________________________________________
Mercurial mailing list
Merc...@selenic.com
http://selenic.com/mailman/listinfo/mercurial

Matt Mackall

unread,
Jan 17, 2012, 11:20:05 PM1/17/12
to nemo, merc...@selenic.com
On Wed, 2012-01-18 at 11:10 +0800, nemo wrote:
> Hi
>
> I want to display all the changed files and their status in a changeset,
> like this
>
> for f in ctx.files():
> for p in ctx.parents():
> status = f not in p and 'added'
> status = status or (f in ctx and 'modified' or 'removed')
> files.append({'status': status, 'node': node, 'filename': f,})
>
> But it seems doesn't work for merge changeset, ctx.files() returns empty
> list when ctx is a merge changset.

It works correctly, it just doesn't meet your expectations. Please read
the help for 'hg diff', 'hg status', and 'hg log -p' a few times each to
be enlightened regarding merges.

--
Mathematics is the supreme nostalgia of our time.

Reply all
Reply to author
Forward
0 new messages