This is an archive of the discontinued Mercurial Phabricator instance.

merge: make low-level update() private (API)
ClosedPublic

Authored by martinvonz on Sep 21 2020, 4:36 PM.

Details

Summary

We have very few callers left that call the low-level merge.update()
function. I think it's time to make it private. I'll remove the
remaining callers in coming patches, except for one call from the
rebase module. I hope to eventually fix that too, but it's more
complex because it requires teaching merge.graft() to work with a
dirty working copy.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

martinvonz created this revision.Sep 21 2020, 4:36 PM
martinvonz updated this revision to Diff 22767.Sep 23 2020, 3:12 AM
martinvonz updated this revision to Diff 22806.Sep 23 2020, 1:28 PM
pulkit accepted this revision.Sep 25 2020, 3:21 AM
This revision is now accepted and ready to land.Sep 25 2020, 3:21 AM
This revision was automatically updated to reflect the committed changes.

tests/test-install.t and tests/test-duplicateoptions.py are unhappy about this change.

--- /tmp/mercurial-ci/tests/test-duplicateoptions.py.out
+++ /tmp/mercurial-ci/tests/test-duplicateoptions.py.err
@@ -0,0 +1,9 @@
+Traceback (most recent call last):
+  File "/tmp/hgtests.j0rlbd/install/lib/python/mercurial/extensions.py", line 264, in _runextsetup
+    extsetup(ui)
+  File "/tmp/hgtests.j0rlbd/install/lib/python/hgext/fsmonitor/__init__.py", line 730, in extsetup
+    extensions.wrapfunction(merge, b'update', wrapupdate)
+  File "/tmp/hgtests.j0rlbd/install/lib/python/mercurial/extensions.py", line 652, in wrapfunction
+    origfn = getattr(container, funcname)
+AttributeError: 'module' object has no attribute 'update'
+*** failed to set up extension fsmonitor: 'module' object has no attribute 'update'
ERROR: test-duplicateoptions.py output changed

--- /tmp/mercurial-ci/tests/test-install.t
+++ /tmp/mercurial-ci/tests/test-install.t.err
@@ -164,12 +164,28 @@
 
 debuginstall extension support
   $ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false | grep atchman
-  fsmonitor checking for watchman binary... (false)
-   watchman binary missing or broken: warning: Watchman unavailable: watchman exited with code 1
+  Traceback (most recent call last):
+    File "/tmp/hgtests.j0rlbd/install/lib/python/mercurial/extensions.py", line 264, in _runextsetup
+      extsetup(ui)
+    File "/tmp/hgtests.j0rlbd/install/lib/python/hgext/fsmonitor/__init__.py", line 730, in extsetup
+      extensions.wrapfunction(merge, b'update', wrapupdate)
+    File "/tmp/hgtests.j0rlbd/install/lib/python/mercurial/extensions.py", line 652, in wrapfunction
+      origfn = getattr(container, funcname)
+  AttributeError: 'module' object has no attribute 'update'
+  *** failed to set up extension fsmonitor: 'module' object has no attribute 'update'
+  [1]
 Verify the json works too:
   $ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false -Tjson | grep atchman
-    "fsmonitor-watchman": "false",
-    "fsmonitor-watchman-error": "warning: Watchman unavailable: watchman exited with code 1",
+  Traceback (most recent call last):
+    File "/tmp/hgtests.j0rlbd/install/lib/python/mercurial/extensions.py", line 264, in _runextsetup
+      extsetup(ui)
+    File "/tmp/hgtests.j0rlbd/install/lib/python/hgext/fsmonitor/__init__.py", line 730, in extsetup
+      extensions.wrapfunction(merge, b'update', wrapupdate)
+    File "/tmp/hgtests.j0rlbd/install/lib/python/mercurial/extensions.py", line 652, in wrapfunction
+      origfn = getattr(container, funcname)
+  AttributeError: 'module' object has no attribute 'update'
+  *** failed to set up extension fsmonitor: 'module' object has no attribute 'update'
+  [1]
 
 Verify that Mercurial is installable with pip. Note that this MUST be
 the last test in this file, because we do some nasty things to the
ERROR: test-install.t output changed

tests/test-install.t and tests/test-duplicateoptions.py are unhappy about this change.

--- /tmp/mercurial-ci/tests/test-duplicateoptions.py.out
+++ /tmp/mercurial-ci/tests/test-duplicateoptions.py.err
@@ -0,0 +1,9 @@
+Traceback (most recent call last):
+  File "/tmp/hgtests.j0rlbd/install/lib/python/mercurial/extensions.py", line 264, in _runextsetup
+    extsetup(ui)
+  File "/tmp/hgtests.j0rlbd/install/lib/python/hgext/fsmonitor/__init__.py", line 730, in extsetup
+    extensions.wrapfunction(merge, b'update', wrapupdate)
+  File "/tmp/hgtests.j0rlbd/install/lib/python/mercurial/extensions.py", line 652, in wrapfunction
+    origfn = getattr(container, funcname)
+AttributeError: 'module' object has no attribute 'update'
+*** failed to set up extension fsmonitor: 'module' object has no attribute 'update'
ERROR: test-duplicateoptions.py output changed
--- /tmp/mercurial-ci/tests/test-install.t
+++ /tmp/mercurial-ci/tests/test-install.t.err
@@ -164,12 +164,28 @@
 debuginstall extension support
   $ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false | grep atchman
-  fsmonitor checking for watchman binary... (false)
-   watchman binary missing or broken: warning: Watchman unavailable: watchman exited with code 1
+  Traceback (most recent call last):
+    File "/tmp/hgtests.j0rlbd/install/lib/python/mercurial/extensions.py", line 264, in _runextsetup
+      extsetup(ui)
+    File "/tmp/hgtests.j0rlbd/install/lib/python/hgext/fsmonitor/__init__.py", line 730, in extsetup
+      extensions.wrapfunction(merge, b'update', wrapupdate)
+    File "/tmp/hgtests.j0rlbd/install/lib/python/mercurial/extensions.py", line 652, in wrapfunction
+      origfn = getattr(container, funcname)
+  AttributeError: 'module' object has no attribute 'update'
+  *** failed to set up extension fsmonitor: 'module' object has no attribute 'update'
+  [1]
 Verify the json works too:
   $ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false -Tjson | grep atchman
-    "fsmonitor-watchman": "false",
-    "fsmonitor-watchman-error": "warning: Watchman unavailable: watchman exited with code 1",
+  Traceback (most recent call last):
+    File "/tmp/hgtests.j0rlbd/install/lib/python/mercurial/extensions.py", line 264, in _runextsetup
+      extsetup(ui)
+    File "/tmp/hgtests.j0rlbd/install/lib/python/hgext/fsmonitor/__init__.py", line 730, in extsetup
+      extensions.wrapfunction(merge, b'update', wrapupdate)
+    File "/tmp/hgtests.j0rlbd/install/lib/python/mercurial/extensions.py", line 652, in wrapfunction
+      origfn = getattr(container, funcname)
+  AttributeError: 'module' object has no attribute 'update'
+  *** failed to set up extension fsmonitor: 'module' object has no attribute 'update'
+  [1]
 Verify that Mercurial is installable with pip. Note that this MUST be
 the last test in this file, because we do some nasty things to the
ERROR: test-install.t output changed

Since this was the tip, I amended the fix and pushed (with 23k obsmarkers).

tests/test-install.t and tests/test-duplicateoptions.py are unhappy about this change.

Since this was the tip, I amended the fix and pushed (with 23k obsmarkers).

Sorry that I didn't notice that and thanks for fixing!