Patchwork D1872: directaccess: update directaccess generic message to also display obsfate

login
register
mail settings
Submitter phabricator
Date Jan. 17, 2018, 11:41 a.m.
Message ID <differential-rev-PHID-DREV-6hk2xgck5sxwt3wsvnp5-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26811/
State New
Headers show

Comments

phabricator - Jan. 17, 2018, 11:41 a.m.
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Display the same message we added recently to the filtered error message when
  try to do a write operation to a hidden obsolete changeset.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1872

AFFECTED FILES
  mercurial/scmutil.py
  tests/test-directaccess.t

CHANGE DETAILS




To: lothiraldan, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-directaccess.t b/tests/test-directaccess.t
--- a/tests/test-directaccess.t
+++ b/tests/test-directaccess.t
@@ -270,14 +270,18 @@ 
 
   $ hg writedirectaccess -r 28ad74
   warning: accessing hidden changesets for write operation: 28ad74487de9
+  hidden revision '28ad74487de9' was rewritten as: d716de383093
   RANGE [2]
 
   $ hg writedirectaccess -r 2443a0
   warning: accessing hidden changesets for write operation: 2443a0e66469
+  hidden revision '2443a0e66469' was rewritten as: d716de383093
   RANGE [3]
 
   $ hg writedirectaccess -r "28ad74:2443a0"
   warning: accessing hidden changesets for write operation: 28ad74487de9, 2443a0e66469
+  hidden revision '28ad74487de9' was rewritten as: d716de383093
+  hidden revision '2443a0e66469' was rewritten as: d716de383093
   RANGE [2, 3]
 
   $ hg writedirectaccess -r "28ad74 + 2443a0"
@@ -287,6 +291,7 @@ 
 
   $ hg writedirectaccess -r "28ad74:d716de"
   warning: accessing hidden changesets for write operation: 28ad74487de9
+  hidden revision '28ad74487de9' was rewritten as: d716de383093
   RANGE [2, 3, 4]
 
 Setting a bookmark will make that changeset unhidden, so this should come in end
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1341,9 +1341,21 @@ 
 
     if hiddentype == 'warn':
         unfi = repo.unfiltered()
-        revstr = ", ".join([pycompat.bytestr(unfi[l]) for l in revs])
+
+        revstr = []
+        obsfatemsgs = []
+
+        for revision in revs:
+            ctx = unfi[revision]
+            revstring = pycompat.bytestr(ctx)
+            revstr.append(revstring)
+            obsfatemsgs.append(obsutil._getfilteredreason(repo, revstring, ctx))
+
         repo.ui.warn(_("warning: accessing hidden changesets for write "
-                       "operation: %s\n") % revstr)
+                       "operation: %s\n") % ", ".join(revstr))
+
+        for obsfatemsg in obsfatemsgs:
+            repo.ui.warn(obsfatemsg + "\n")
 
     # we have to use new filtername to separate branch/tags cache until we can
     # disbale these cache when revisions are dynamically pinned.