Patchwork [Bug,4911] New: No way to tell that copy metadata was dropped

login
register
mail settings
Submitter mercurial-bugs@selenic.com
Date Oct. 20, 2015, 10:39 p.m.
Message ID <bug-4911-285@https.bz.mercurial-scm.org/>
Download mbox | patch
Permalink /patch/11209/
State Not Applicable
Headers show

Comments

mercurial-bugs@selenic.com - Oct. 20, 2015, 10:39 p.m.
https://bz.mercurial-scm.org/show_bug.cgi?id=4911

            Bug ID: 4911
           Summary: No way to tell that copy metadata was dropped
           Product: Mercurial
           Version: default branch
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla@selenic.com
          Reporter: gregory.szorc@gmail.com
                CC: dbaron@dbaron.org, mercurial-devel@selenic.com

A Mozilla engineer reported that `hg blame dom/base/Element.cpp` (from
https://hg.mozilla.org/mozilla-central) was returning incorrect results. He
expected most lines in that file to be blamed down to rev 0, which is the
import of a CVS snapshot into the repository (not nearly empty like most
repos).

Instead, blame is reporting 97504:f3cd319dd52d as the base revision.

  $ hg export f3cd319dd52d

# HG changeset patch
# User Justin Lebar <justin.lebar@gmail.com>
# Date 1340463912 14400
#      Sat Jun 23 11:05:12 2012 -0400
# Node ID f3cd319dd52d6d0cce725639db34dedbaa59d28a
# Parent  65dff94ced6a40070c90f35e25a29f4923fa2e2a
Bug 766481 - Part 1: Make alert work from <iframe>s within <iframe mozbrowser>.
r=mounir

*/

We see content/base/src/nsINode.cpp has only a little history before our
original "trouble" changeset:

changeset:   97398:0a14c3b24796
user:        Ms2ger <ms2ger@gmail.com>
date:        Sat Jun 23 08:58:04 2012 +0200
summary:     Bug 767130 - Consolidate code duplicated between
nsGenericElement.cpp and nsINode.cpp; r=bz

changeset:   97396:187571843979
user:        Ms2ger <ms2ger@gmail.com>
date:        Sat Jun 23 08:57:01 2012 +0200
summary:     Bug 767130 - Create nsINode.cpp; r=mounir

The copyrev metadata points at the 2nd revlog entry. From `hg debugindex`:

  1     16131     326      0   97398 6e505d8f3fb1 e8f3274ff5f5 000000000000

linkrev 97398 corresponds to the last file revision of
content/base/src/nsINode.cpp at the time of our "trouble" changeset.

It's obvious from poking around the history before our trouble changeset
(97504:f3cd319dd52d) that the addition of the copy metadata in that file is
just plain wrong. The file was not copied as part of this changeset. I'm not
sure if this is user error or a bug in 2012 era Mercurial (possibly involving
MQ).

Anyway, it took me several minutes and many `hg debug*` commands to track this
down because it wasn't obvious from output of existing commands. Part of me
thinks that `hg export f3cd319dd52d` or `hg log -r f3cd319dd52d` should somehow
report that copy metadata was added to content/base/src/nsGenericElement.cpp.
After all, there was a files entry in the changelog and the manifest was
different for this path. I'd expect that to get reflected in the UI. How, I'm
not sure.

AFAICT, this isn't a regression.

Patch

diff --git dom/browser-element/BrowserElementPromptService.jsm
dom/browser-element/BrowserElementPromptService.jsm
--- dom/browser-element/BrowserElementPromptService.jsm
+++ dom/browser-element/BrowserElementPromptService.jsm
@@ -161,17 +161,20 @@  let BrowserElementPromptService = {
...

No dom/base/Element.cpp in sight. Weird. Let's see what the changelog says:

  $ hg --debug log -r f3cd319dd52d

changeset:   97504:f3cd319dd52d6d0cce725639db34dedbaa59d28a
phase:       public
parent:      97503:65dff94ced6a40070c90f35e25a29f4923fa2e2a
parent:      -1:0000000000000000000000000000000000000000
manifest:    97447:e9ac1375af32fbd59594e2cda50faf835a1233b5
user:        Justin Lebar <justin.lebar@gmail.com>
date:        Sat Jun 23 11:05:12 2012 -0400
files:       content/base/src/nsGenericElement.cpp
dom/browser-element/BrowserElementPromptService.jsm
extra:       branch=default
extra:       rebase_source=0ec4647ab93c4be23967d234d48f63102444fb9c
description:
Bug 766481 - Part 1: Make alert work from <iframe>s within <iframe mozbrowser>.
r=mounir

We see content/base/src/nsGenericElement.cpp in the files list. Long story
short, content/base/src/nsGenericElement.cpp was renamed to
dom/base/Element.cpp in 212358:2db29c0ae60b.

If you diff manifests 97446:e165e991a16ff800070f9ee9f201ed00c745077b (p1's
manifest) and 97447:e9ac1375af32fbd59594e2cda50faf835a1233b5, you find that
they have different filelog entries for content/base/src/nsGenericElement.cpp:
7a703da2249982a5b4a0820b921a2cf1af863a32 and
78f9260127ad1453a5943172d274a1eb1069b929, respectively.

  $ hg debugdata content/base/src/nsGenericElement.cpp
7a703da2249982a5b4a0820b921a2cf1af863a32 > base

  $ hg debugdata content/base/src/nsGenericElement.cpp
78f9260127ad1453a5943172d274a1eb1069b929 > tip

  $ diff -U1 base tip

--- base        2015-10-20 15:20:07.000000000 -0700
+++ tip 2015-10-20 15:19:59.000000000 -0700
@@ -1 +1,5 @@ 
+
+copy: content/base/src/nsINode.cpp
+copyrev: 6e505d8f3fb1564c4cfd8b47ee1525097713217f
+
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-