diff --git a/mercurial/metadata.py b/mercurial/metadata.py --- a/mercurial/metadata.py +++ b/mercurial/metadata.py @@ -226,6 +226,10 @@ class ChangingFiles(object): def compute_all_files_changes(ctx): """compute the files changed by a revision""" + p1 = ctx.p1() + p2 = ctx.p2() + if p1.rev() == node.nullrev and p2.rev() == node.nullrev: + return _process_root(ctx) filescopies = computechangesetcopies(ctx) filesadded = computechangesetfilesadded(ctx) filesremoved = computechangesetfilesremoved(ctx) @@ -240,6 +244,17 @@ def compute_all_files_changes(ctx): return files +def _process_root(ctx): + """compute the appropriate changed files for a changeset with no parents + """ + # Simple, there was nothing before it, so everything is added. + md = ChangingFiles() + manifest = ctx.manifest() + for filename in manifest: + md.mark_added(filename) + return md + + def computechangesetfilesadded(ctx): """return the list of files added in a changeset """