[PATCH 1 of 5] debugmergestate: show extras for files which are not in mergestate

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 1 of 5] debugmergestate: show extras for files which are not in mergestate

Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1598275759 -19800
#      Mon Aug 24 18:59:19 2020 +0530
# Node ID c196dc7f6cf18e32a8646ae7cd0b08014f8ffbdf
# Parent  c889e1fddc190ff73265939965706b2dd0bfec3b
# EXP-Topic merge-newnode
debugmergestate: show extras for files which are not in mergestate

With recent changes and future changes, we will like to store extras information
about files which were merged automatically. Hence, we will have merge extras
for files which are not in the mergestate.

Differential Revision: https://phab.mercurial-scm.org/D8942

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2016,6 +2016,7 @@ def debugmergestate(ui, repo, *args, **o
             b'")}'
             b'{extras % "  extra: {key} = {value}\n"}'
             b'"}'
+            b'{extras % "extra: {file} ({key} = {value})\n"}'
         )
 
     ms = mergestatemod.mergestate.read(repo)
@@ -2069,6 +2070,18 @@ def debugmergestate(ui, repo, *args, **o
 
     fm_files.end()
 
+    fm_extras = fm.nested(b'extras')
+    for f, d in sorted(pycompat.iteritems(ms._stateextras)):
+        if f in ms:
+            # If file is in mergestate, we have already processed it's extras
+            continue
+        for k, v in pycompat.iteritems(d):
+            fm_extras.startitem()
+            fm_extras.data(file=f)
+            fm_extras.data(key=k)
+            fm_extras.data(value=v)
+    fm_extras.end()
+
     fm.end()
 
 
diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -328,6 +328,7 @@ test json output
   [
    {
     "commits": [{"label": "working copy", "name": "local", "node": "57653b9f834a4493f7240b0681efcb9ae7cab745"}, {"label": "merge rev", "name": "other", "node": "dc77451844e37f03f5c559e3b8529b2b48d381d1"}],
+    "extras": [],
     "files": [{"ancestor_node": "2ed2a3912a0b24502043eae84ee4b279c18b90dd", "ancestor_path": "file1", "extras": [{"key": "ancestorlinknode", "value": "99726c03216e233810a2564cbc0adfe395007eac"}], "local_flags": "", "local_key": "60b27f004e454aca81b0480209cce5081ec52390", "local_path": "file1", "other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", "other_path": "file1", "path": "file1", "state": "r"}, {"ancestor_node": "2ed2a3912a0b24502043eae84ee4b279c18b90dd", "ancestor_path": "file2", "extras": [{"key": "ancestorlinknode", "value": "99726c03216e233810a2564cbc0adfe395007eac"}], "local_flags": "", "local_key": "cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523", "local_path": "file2", "other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", "other_path": "file2", "path": "file2", "state": "u"}]
    }
   ]
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 2 of 5] merge: show list of bids for each file in bid-merge in ui.note()

Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1598442653 -19800
#      Wed Aug 26 17:20:53 2020 +0530
# Node ID 76753724e6b5453d9540c73b1a1a6f11de818e46
# Parent  c196dc7f6cf18e32a8646ae7cd0b08014f8ffbdf
# EXP-Topic merge-newnode
merge: show list of bids for each file in bid-merge in ui.note()

Earlier, we were showing the list of bids only when we were ambiguously picking.
However, the cases where we unambiguously picked a side may not always be
correct and need to be fixed.

Having list of bids for all files will be helpful in debugging.

Differential Revision: https://phab.mercurial-scm.org/D8966

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1154,37 +1154,35 @@ def calculateupdates(
         repo.ui.note(_(b'\nauction for merging merge bids\n'))
         mresult = mergeresult()
         for f, bids in sorted(fbids.items()):
+            repo.ui.note(_(b" %s:\n   list of bids:\n") % f)
+            for m, l in sorted(bids.items()):
+                for _f, args, msg in l:
+                    repo.ui.note(b'     %s -> %s\n' % (msg, m))
             # bids is a mapping from action method to list af actions
             # Consensus?
             if len(bids) == 1:  # all bids are the same kind of method
                 m, l = list(bids.items())[0]
                 if all(a == l[0] for a in l[1:]):  # len(bids) is > 1
-                    repo.ui.note(_(b" %s: consensus for %s\n") % (f, m))
+                    repo.ui.note(_(b"   consensus for %s\n") % (m))
                     mresult.addfile(f, *l[0])
                     continue
             # If keep is an option, just do it.
             if mergestatemod.ACTION_KEEP in bids:
-                repo.ui.note(_(b" %s: picking 'keep' action\n") % f)
+                repo.ui.note(_(b"   picking 'keep' action\n"))
                 mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP][0])
                 continue
             # If there are gets and they all agree [how could they not?], do it.
             if mergestatemod.ACTION_GET in bids:
                 ga0 = bids[mergestatemod.ACTION_GET][0]
                 if all(a == ga0 for a in bids[mergestatemod.ACTION_GET][1:]):
-                    repo.ui.note(_(b" %s: picking 'get' action\n") % f)
+                    repo.ui.note(_(b"   picking 'get' action\n"))
                     mresult.addfile(f, *ga0)
                     continue
             # TODO: Consider other simple actions such as mode changes
             # Handle inefficient democrazy.
-            repo.ui.note(_(b' %s: multiple bids for merge action:\n') % f)
-            for m, l in sorted(bids.items()):
-                for _f, args, msg in l:
-                    repo.ui.note(b'  %s -> %s\n' % (msg, m))
             # Pick random action. TODO: Instead, prompt user when resolving
             m, l = list(bids.items())[0]
-            repo.ui.warn(
-                _(b' %s: ambiguous merge - picked %s action\n') % (f, m)
-            )
+            repo.ui.warn(_(b'   ambiguous merge - picked %s action\n') % (m))
             mresult.addfile(f, *l[0])
             continue
         repo.ui.note(_(b'end of auction\n\n'))
diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t
--- a/tests/test-merge-criss-cross.t
+++ b/tests/test-merge-criss-cross.t
@@ -150,8 +150,16 @@ Redo merge with merge.preferancestor="*"
    f2: remote unchanged -> k
   
   auction for merging merge bids
-   f1: picking 'get' action
-   f2: picking 'keep' action
+   f1:
+     list of bids:
+       remote is newer -> g
+       versions differ -> m
+     picking 'get' action
+   f2:
+     list of bids:
+       remote unchanged -> k
+       versions differ -> m
+     picking 'keep' action
   end of auction
   
    f1: remote is newer -> g
@@ -193,8 +201,16 @@ The other way around:
    f2: remote is newer -> g
   
   auction for merging merge bids
-   f1: picking 'keep' action
-   f2: picking 'get' action
+   f1:
+     list of bids:
+       remote unchanged -> k
+       versions differ -> m
+     picking 'keep' action
+   f2:
+     list of bids:
+       remote is newer -> g
+       versions differ -> m
+     picking 'get' action
   end of auction
   
    f2: remote is newer -> g
@@ -231,8 +247,16 @@ Verify how the output looks and and how
   resolving manifests
   
   auction for merging merge bids
-   f1: picking 'get' action
-   f2: picking 'keep' action
+   f1:
+     list of bids:
+       remote is newer -> g
+       versions differ -> m
+     picking 'get' action
+   f2:
+     list of bids:
+       remote unchanged -> k
+       versions differ -> m
+     picking 'keep' action
   end of auction
   
   getting f1
@@ -258,8 +282,16 @@ Verify how the output looks and and how
    f2: remote unchanged -> k
   
   auction for merging merge bids
-   f1: picking 'get' action
-   f2: picking 'keep' action
+   f1:
+     list of bids:
+       remote is newer -> g
+       versions differ -> m
+     picking 'get' action
+   f2:
+     list of bids:
+       remote unchanged -> k
+       versions differ -> m
+     picking 'keep' action
   end of auction
   
    f1: remote is newer -> g
@@ -344,10 +376,11 @@ http://stackoverflow.com/questions/93500
   resolving manifests
   
   auction for merging merge bids
-   x: multiple bids for merge action:
-    versions differ -> m
-    versions differ -> m
-   x: ambiguous merge - picked m action
+   x:
+     list of bids:
+       versions differ -> m
+       versions differ -> m
+     ambiguous merge - picked m action
   end of auction
   
   merging x
@@ -431,9 +464,19 @@ Verify that the old context ancestor wor
    d2/b: remote created -> g
   
   auction for merging merge bids
-   d1/a: consensus for r
-   d1/b: consensus for r
-   d2/b: consensus for g
+   d1/a:
+     list of bids:
+       other deleted -> r
+     consensus for r
+   d1/b:
+     list of bids:
+       other deleted -> r
+     consensus for r
+   d2/b:
+     list of bids:
+       remote created -> g
+       remote created -> g
+     consensus for g
   end of auction
   
    d1/a: other deleted -> r
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 3 of 5] merge: show number of ancestors in bid merge debug notes

Pulkit Goyal
In reply to this post by Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1598442862 -19800
#      Wed Aug 26 17:24:22 2020 +0530
# Node ID 4e5bb80a831d8201e3407cf78721b8d2d236b74d
# Parent  76753724e6b5453d9540c73b1a1a6f11de818e46
# EXP-Topic merge-newnode
merge: show number of ancestors in bid merge debug notes

A good number of times, we don't generate an action for a file in
manifestmerge() which can result in bid merge doing the wrong thing.

Mentioning the number of ancestors from which we are bidding will help spot such
cases where we are not returning an action.

Differential Revision: https://phab.mercurial-scm.org/D8967

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1151,7 +1151,10 @@ def calculateupdates(
 
         # Call for bids
         # Pick the best bid for each file
-        repo.ui.note(_(b'\nauction for merging merge bids\n'))
+        repo.ui.note(
+            _(b'\nauction for merging merge bids (%d ancestors)\n')
+            % len(ancestors)
+        )
         mresult = mergeresult()
         for f, bids in sorted(fbids.items()):
             repo.ui.note(_(b" %s:\n   list of bids:\n") % f)
diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t
--- a/tests/test-merge-criss-cross.t
+++ b/tests/test-merge-criss-cross.t
@@ -149,7 +149,7 @@ Redo merge with merge.preferancestor="*"
    f1: versions differ -> m
    f2: remote unchanged -> k
   
-  auction for merging merge bids
+  auction for merging merge bids (2 ancestors)
    f1:
      list of bids:
        remote is newer -> g
@@ -200,7 +200,7 @@ The other way around:
    f1: versions differ -> m
    f2: remote is newer -> g
   
-  auction for merging merge bids
+  auction for merging merge bids (2 ancestors)
    f1:
      list of bids:
        remote unchanged -> k
@@ -246,7 +246,7 @@ Verify how the output looks and and how
   calculating bids for ancestor 40663881a6dd
   resolving manifests
   
-  auction for merging merge bids
+  auction for merging merge bids (2 ancestors)
    f1:
      list of bids:
        remote is newer -> g
@@ -281,7 +281,7 @@ Verify how the output looks and and how
    f1: versions differ -> m
    f2: remote unchanged -> k
   
-  auction for merging merge bids
+  auction for merging merge bids (2 ancestors)
    f1:
      list of bids:
        remote is newer -> g
@@ -375,7 +375,7 @@ http://stackoverflow.com/questions/93500
   calculating bids for ancestor b211bbc6eb3c
   resolving manifests
   
-  auction for merging merge bids
+  auction for merging merge bids (2 ancestors)
    x:
      list of bids:
        versions differ -> m
@@ -463,7 +463,7 @@ Verify that the old context ancestor wor
    d1/b: other deleted -> r
    d2/b: remote created -> g
   
-  auction for merging merge bids
+  auction for merging merge bids (2 ancestors)
    d1/a:
      list of bids:
        other deleted -> r
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 4 of 5] debugmergestate: sort extras before printing

Pulkit Goyal
In reply to this post by Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1599124516 -19800
#      Thu Sep 03 14:45:16 2020 +0530
# Node ID 8abe98dc3e3c020566d64ac3f3b802de2751d55f
# Parent  4e5bb80a831d8201e3407cf78721b8d2d236b74d
# EXP-Topic merge-newnode
debugmergestate: sort extras before printing

Prevents flaky output.

Differential Revision: https://phab.mercurial-scm.org/D8986

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2062,7 +2062,7 @@ def debugmergestate(ui, repo, *args, **o
                 fm_files.data(renamed_path=state[1])
                 fm_files.data(rename_side=state[2])
             fm_extras = fm_files.nested(b'extras')
-            for k, v in ms.extras(f).items():
+            for k, v in sorted(ms.extras(f).items()):
                 fm_extras.startitem()
                 fm_extras.data(key=k)
                 fm_extras.data(value=v)
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 5 of 5] merge: move initial handling of mergeactions near to later one

Pulkit Goyal
In reply to this post by Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1599119729 -19800
#      Thu Sep 03 13:25:29 2020 +0530
# Node ID c48ee69a8c7202517cade973b3abe3715bfc3c5e
# Parent  8abe98dc3e3c020566d64ac3f3b802de2751d55f
# EXP-Topic merge-newnode
merge: move initial handling of mergeactions near to later one

We build `mergeactions` in the beginning and use it in end. Let's build it just
before where it will be used. Helps making code much easier to understand.

Differential Revision: https://phab.mercurial-scm.org/D8983

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1370,49 +1370,6 @@ def applyupdates(
         # mergestate so that it can be reused on commit
         ms.addcommitinfo(f, op)
 
-    moves = []
-
-    # 'cd' and 'dc' actions are treated like other merge conflicts
-    mergeactions = list(
-        mresult.getactions(
-            [
-                mergestatemod.ACTION_CHANGED_DELETED,
-                mergestatemod.ACTION_DELETED_CHANGED,
-                mergestatemod.ACTION_MERGE,
-            ],
-            sort=True,
-        )
-    )
-    for f, args, msg in mergeactions:
-        f1, f2, fa, move, anc = args
-        if f == b'.hgsubstate':  # merged internally
-            continue
-        if f1 is None:
-            fcl = filemerge.absentfilectx(wctx, fa)
-        else:
-            repo.ui.debug(b" preserving %s for resolve of %s\n" % (f1, f))
-            fcl = wctx[f1]
-        if f2 is None:
-            fco = filemerge.absentfilectx(mctx, fa)
-        else:
-            fco = mctx[f2]
-        actx = repo[anc]
-        if fa in actx:
-            fca = actx[fa]
-        else:
-            # TODO: move to absentfilectx
-            fca = repo.filectx(f1, fileid=nullrev)
-        ms.add(fcl, fco, fca, f)
-        if f1 != f and move:
-            moves.append(f1)
-
-    # remove renamed files after safely stored
-    for f in moves:
-        if wctx[f].lexists():
-            repo.ui.debug(b"removing %s\n" % f)
-            wctx[f].audit()
-            wctx[f].remove()
-
     numupdates = mresult.len() - mresult.len((mergestatemod.ACTION_KEEP,))
     progress = repo.ui.makeprogress(
         _(b'updating'), unit=_(b'files'), total=numupdates
@@ -1555,6 +1512,49 @@ def applyupdates(
         wctx[f].audit()
         wctx[f].setflags(b'l' in flags, b'x' in flags)
 
+    moves = []
+
+    # 'cd' and 'dc' actions are treated like other merge conflicts
+    mergeactions = list(
+        mresult.getactions(
+            [
+                mergestatemod.ACTION_CHANGED_DELETED,
+                mergestatemod.ACTION_DELETED_CHANGED,
+                mergestatemod.ACTION_MERGE,
+            ],
+            sort=True,
+        )
+    )
+    for f, args, msg in mergeactions:
+        f1, f2, fa, move, anc = args
+        if f == b'.hgsubstate':  # merged internally
+            continue
+        if f1 is None:
+            fcl = filemerge.absentfilectx(wctx, fa)
+        else:
+            repo.ui.debug(b" preserving %s for resolve of %s\n" % (f1, f))
+            fcl = wctx[f1]
+        if f2 is None:
+            fco = filemerge.absentfilectx(mctx, fa)
+        else:
+            fco = mctx[f2]
+        actx = repo[anc]
+        if fa in actx:
+            fca = actx[fa]
+        else:
+            # TODO: move to absentfilectx
+            fca = repo.filectx(f1, fileid=nullrev)
+        ms.add(fcl, fco, fca, f)
+        if f1 != f and move:
+            moves.append(f1)
+
+    # remove renamed files after safely stored
+    for f in moves:
+        if wctx[f].lexists():
+            repo.ui.debug(b"removing %s\n" % f)
+            wctx[f].audit()
+            wctx[f].remove()
+
     # these actions updates the file
     updated = mresult.len(
         (
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -247,9 +247,9 @@ Graft out of order, skipping a merge and
   resolving manifests
    branchmerge: True, force: True, partial: False
    ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
-   preserving e for resolve of e
    d: remote is newer -> g
   getting d
+   preserving e for resolve of e
    e: versions differ -> m (premerge)
   picked tool ':merge' for e (binary False symlink False changedelete False)
   merging e
diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t
--- a/tests/test-merge-criss-cross.t
+++ b/tests/test-merge-criss-cross.t
@@ -78,9 +78,9 @@ Criss cross merging
   resolving manifests
    branchmerge: True, force: False, partial: False
    ancestor: 0f6b37dbe527, local: 3b08d01b0ab5+, remote: adfe50279922
-   preserving f2 for resolve of f2
    f1: remote is newer -> g
   getting f1
+   preserving f2 for resolve of f2
    f2: versions differ -> m (premerge)
   picked tool ':dump' for f2 (binary False symlink False changedelete False)
   merging f2
diff --git a/tests/test-rename-merge1.t b/tests/test-rename-merge1.t
--- a/tests/test-rename-merge1.t
+++ b/tests/test-rename-merge1.t
@@ -40,10 +40,10 @@
   note: possible conflict - a2 was renamed multiple times to:
    b2
    c2
+   b2: remote created -> g
+  getting b2
    preserving a for resolve of b
   removing a
-   b2: remote created -> g
-  getting b2
    b: remote moved from a -> m (premerge)
   picked tool ':merge' for b (binary False symlink False changedelete False)
   merging a and b to b
diff --git a/tests/test-rename-merge2.t b/tests/test-rename-merge2.t
--- a/tests/test-rename-merge2.t
+++ b/tests/test-rename-merge2.t
@@ -89,6 +89,7 @@ args:
    preserving rev for resolve of rev
   starting 4 threads for background file closing (?)
    b: remote copied from a -> m (premerge)
+  starting 4 threads for background file closing (?)
   picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
   merging a and b to b
   my b@e300d1c794ec+ other b@4ce40f5aca24 ancestor a@924404dff337
@@ -124,10 +125,10 @@ args:
   resolving manifests
    branchmerge: True, force: False, partial: False
    ancestor: 924404dff337, local: 86a2aa42fc76+, remote: f4db7e329e71
+   a: remote is newer -> g
+  getting a
    preserving b for resolve of b
    preserving rev for resolve of rev
-   a: remote is newer -> g
-  getting a
    b: local copied/moved from a -> m (premerge)
   picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
   merging b and a to b
@@ -241,9 +242,9 @@ args:
   resolving manifests
    branchmerge: True, force: False, partial: False
    ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: 4ce40f5aca24
-   preserving rev for resolve of rev
    b: remote created -> g
   getting b
+   preserving rev for resolve of rev
    rev: versions differ -> m (premerge)
   picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
   merging rev
@@ -306,11 +307,11 @@ args:
   resolving manifests
    branchmerge: True, force: False, partial: False
    ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: bdb19105162a
-   preserving rev for resolve of rev
    a: other deleted -> r
   removing a
    b: remote created -> g
   getting b
+   preserving rev for resolve of rev
    rev: versions differ -> m (premerge)
   picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
   merging rev
@@ -422,9 +423,9 @@ m "um a c" "um x c" "      " "10 do merg
   note: possible conflict - a was renamed multiple times to:
    b
    c
-   preserving rev for resolve of rev
    c: remote created -> g
   getting c
+   preserving rev for resolve of rev
    rev: versions differ -> m (premerge)
   picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
   merging rev
@@ -493,10 +494,10 @@ m "um a c" "um x c" "      " "10 do merg
   resolving manifests
    branchmerge: True, force: False, partial: False
    ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
+   a: other deleted -> r
+  removing a
    preserving b for resolve of b
    preserving rev for resolve of rev
-   a: other deleted -> r
-  removing a
   starting 4 threads for background file closing (?)
    b: both created -> m (premerge)
   picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
@@ -534,10 +535,10 @@ m "um a c" "um x c" "      " "10 do merg
   resolving manifests
    branchmerge: True, force: False, partial: False
    ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
+   a: remote is newer -> g
+  getting a
    preserving b for resolve of b
    preserving rev for resolve of rev
-   a: remote is newer -> g
-  getting a
    b: both renamed from a -> m (premerge)
   picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
   merging b
@@ -571,10 +572,10 @@ m "um a c" "um x c" "      " "10 do merg
   resolving manifests
    branchmerge: True, force: False, partial: False
    ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
+   a: other deleted -> r
+  removing a
    preserving b for resolve of b
    preserving rev for resolve of rev
-   a: other deleted -> r
-  removing a
   starting 4 threads for background file closing (?)
    b: both created -> m (premerge)
   picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
@@ -612,10 +613,10 @@ m "um a c" "um x c" "      " "10 do merg
   resolving manifests
    branchmerge: True, force: False, partial: False
    ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
+   a: remote is newer -> g
+  getting a
    preserving b for resolve of b
    preserving rev for resolve of rev
-   a: remote is newer -> g
-  getting a
    b: both renamed from a -> m (premerge)
   picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
   merging b
@@ -653,6 +654,7 @@ m "um a c" "um x c" "      " "10 do merg
    preserving rev for resolve of rev
   starting 4 threads for background file closing (?)
    b: both renamed from a -> m (premerge)
+  starting 4 threads for background file closing (?)
   picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
   merging b
   my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor a@924404dff337
@@ -848,10 +850,10 @@ m "nm a b" "um x a" "      " "22 get a,
   resolving manifests
    branchmerge: True, force: False, partial: False
    ancestor: 924404dff337, local: 02963e448370+, remote: 2b958612230f
+   c: remote created -> g
+  getting c
    preserving b for resolve of b
    preserving rev for resolve of rev
-   c: remote created -> g
-  getting c
    b: local copied/moved from a -> m (premerge)
   picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
   merging b and a to b
diff --git a/tests/test-up-local-change.t b/tests/test-up-local-change.t
--- a/tests/test-up-local-change.t
+++ b/tests/test-up-local-change.t
@@ -43,9 +43,9 @@
   resolving manifests
    branchmerge: False, force: False, partial: False
    ancestor: c19d34741b0a, local: c19d34741b0a+, remote: 1e71731e6fbb
-   preserving a for resolve of a
    b: remote created -> g
   getting b
+   preserving a for resolve of a
    a: versions differ -> m (premerge)
   picked tool 'true' for a (binary False symlink False changedelete False)
   merging a
@@ -68,9 +68,9 @@
   resolving manifests
    branchmerge: False, force: False, partial: False
    ancestor: 1e71731e6fbb, local: 1e71731e6fbb+, remote: c19d34741b0a
-   preserving a for resolve of a
    b: other deleted -> r
   removing b
+   preserving a for resolve of a
   starting 4 threads for background file closing (?)
    a: versions differ -> m (premerge)
   picked tool 'true' for a (binary False symlink False changedelete False)
@@ -92,9 +92,9 @@
   resolving manifests
    branchmerge: False, force: False, partial: False
    ancestor: c19d34741b0a, local: c19d34741b0a+, remote: 1e71731e6fbb
-   preserving a for resolve of a
    b: remote created -> g
   getting b
+   preserving a for resolve of a
    a: versions differ -> m (premerge)
   picked tool 'true' for a (binary False symlink False changedelete False)
   merging a
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1 of 5] debugmergestate: show extras for files which are not in mergestate

Yuya Nishihara
In reply to this post by Pulkit Goyal
On Fri, 11 Sep 2020 12:35:29 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <[hidden email]>
> # Date 1598275759 -19800
> #      Mon Aug 24 18:59:19 2020 +0530
> # Node ID c196dc7f6cf18e32a8646ae7cd0b08014f8ffbdf
> # Parent  c889e1fddc190ff73265939965706b2dd0bfec3b
> # EXP-Topic merge-newnode
> debugmergestate: show extras for files which are not in mergestate

Queued 1, 3, 4, thanks.
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 5 of 5] merge: move initial handling of mergeactions near to later one

Yuya Nishihara
In reply to this post by Pulkit Goyal
On Fri, 11 Sep 2020 12:35:33 +0530, Pulkit Goyal wrote:

> # HG changeset patch
> # User Pulkit Goyal <[hidden email]>
> # Date 1599119729 -19800
> #      Thu Sep 03 13:25:29 2020 +0530
> # Node ID c48ee69a8c7202517cade973b3abe3715bfc3c5e
> # Parent  8abe98dc3e3c020566d64ac3f3b802de2751d55f
> # EXP-Topic merge-newnode
> merge: move initial handling of mergeactions near to later one
>
> We build `mergeactions` in the beginning and use it in end. Let's build it just
> before where it will be used. Helps making code much easier to understand.

> -        ms.add(fcl, fco, fca, f)
> -        if f1 != f and move:
> -            moves.append(f1)
> -
> -    # remove renamed files after safely stored
> -    for f in moves:
> -        if wctx[f].lexists():
> -            repo.ui.debug(b"removing %s\n" % f)
> -            wctx[f].audit()
> -            wctx[f].remove()

Needs more eyes. I have no expertise to say this remove() can be moved
after batch gets.
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 2 of 5] merge: show list of bids for each file in bid-merge in ui.note()

Yuya Nishihara
In reply to this post by Pulkit Goyal
On Fri, 11 Sep 2020 12:35:30 +0530, Pulkit Goyal wrote:

> # HG changeset patch
> # User Pulkit Goyal <[hidden email]>
> # Date 1598442653 -19800
> #      Wed Aug 26 17:20:53 2020 +0530
> # Node ID 76753724e6b5453d9540c73b1a1a6f11de818e46
> # Parent  c196dc7f6cf18e32a8646ae7cd0b08014f8ffbdf
> # EXP-Topic merge-newnode
> merge: show list of bids for each file in bid-merge in ui.note()
>
> Earlier, we were showing the list of bids only when we were ambiguously picking.
> However, the cases where we unambiguously picked a side may not always be
> correct and need to be fixed.
>
> Having list of bids for all files will be helpful in debugging.

Will experienced users can/have to understand the output? If it's just for
debugging, I prefer not seeing it unless necessary.

>    auction for merging merge bids
> -   f1: picking 'get' action
> -   f2: picking 'keep' action
> +   f1:
> +     list of bids:
> +       remote is newer -> g
> +       versions differ -> m
> +     picking 'get' action

Nit: if it's not a debug output, maybe it can be more readable by saying
the action first.

  f1: picking 'get' action
    list of bids:
      ...
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 5 of 5] merge: move initial handling of mergeactions near to later one

Pulkit Goyal
In reply to this post by Yuya Nishihara
On Sat, Sep 12, 2020 at 8:31 AM Yuya Nishihara <[hidden email]> wrote:

>
> On Fri, 11 Sep 2020 12:35:33 +0530, Pulkit Goyal wrote:
> > # HG changeset patch
> > # User Pulkit Goyal <[hidden email]>
> > # Date 1599119729 -19800
> > #      Thu Sep 03 13:25:29 2020 +0530
> > # Node ID c48ee69a8c7202517cade973b3abe3715bfc3c5e
> > # Parent  8abe98dc3e3c020566d64ac3f3b802de2751d55f
> > # EXP-Topic merge-newnode
> > merge: move initial handling of mergeactions near to later one
> >
> > We build `mergeactions` in the beginning and use it in end. Let's build it just
> > before where it will be used. Helps making code much easier to understand.
>
> > -        ms.add(fcl, fco, fca, f)
> > -        if f1 != f and move:
> > -            moves.append(f1)
> > -
> > -    # remove renamed files after safely stored
> > -    for f in moves:
> > -        if wctx[f].lexists():
> > -            repo.ui.debug(b"removing %s\n" % f)
> > -            wctx[f].audit()
> > -            wctx[f].remove()
>
> Needs more eyes. I have no expertise to say this remove() can be moved
> after batch gets.

I also was not sure, but all tests passes which made me confident :D
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 2 of 5] merge: show list of bids for each file in bid-merge in ui.note()

Pulkit Goyal
In reply to this post by Yuya Nishihara
On Sat, Sep 12, 2020 at 8:31 AM Yuya Nishihara <[hidden email]> wrote:

>
> On Fri, 11 Sep 2020 12:35:30 +0530, Pulkit Goyal wrote:
> > # HG changeset patch
> > # User Pulkit Goyal <[hidden email]>
> > # Date 1598442653 -19800
> > #      Wed Aug 26 17:20:53 2020 +0530
> > # Node ID 76753724e6b5453d9540c73b1a1a6f11de818e46
> > # Parent  c196dc7f6cf18e32a8646ae7cd0b08014f8ffbdf
> > # EXP-Topic merge-newnode
> > merge: show list of bids for each file in bid-merge in ui.note()
> >
> > Earlier, we were showing the list of bids only when we were ambiguously picking.
> > However, the cases where we unambiguously picked a side may not always be
> > correct and need to be fixed.
> >
> > Having list of bids for all files will be helpful in debugging.
>
> Will experienced users can/have to understand the output? If it's just for
> debugging, I prefer not seeing it unless necessary.

It's for debugging purposes only. Right now, a lot of times the merge
code does not add an action for an ancestor. This leads to bid merge
doing the wrong thing.
This and showing number of ancestors in this debug output is meant to
track down such cases where `manifestmerge()` is missing adding action
for a file for some ancestors.

>
> >    auction for merging merge bids
> > -   f1: picking 'get' action
> > -   f2: picking 'keep' action
> > +   f1:
> > +     list of bids:
> > +       remote is newer -> g
> > +       versions differ -> m
> > +     picking 'get' action
>
> Nit: if it's not a debug output, maybe it can be more readable by saying
> the action first.
>
>   f1: picking 'get' action
>     list of bids:
>       ...
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 2 of 5] merge: show list of bids for each file in bid-merge in ui.note()

Yuya Nishihara
On Mon, 14 Sep 2020 13:44:37 +0530, Pulkit Goyal wrote:

> On Sat, Sep 12, 2020 at 8:31 AM Yuya Nishihara <[hidden email]> wrote:
> >
> > On Fri, 11 Sep 2020 12:35:30 +0530, Pulkit Goyal wrote:
> > > # HG changeset patch
> > > # User Pulkit Goyal <[hidden email]>
> > > # Date 1598442653 -19800
> > > #      Wed Aug 26 17:20:53 2020 +0530
> > > # Node ID 76753724e6b5453d9540c73b1a1a6f11de818e46
> > > # Parent  c196dc7f6cf18e32a8646ae7cd0b08014f8ffbdf
> > > # EXP-Topic merge-newnode
> > > merge: show list of bids for each file in bid-merge in ui.note()
> > >
> > > Earlier, we were showing the list of bids only when we were ambiguously picking.
> > > However, the cases where we unambiguously picked a side may not always be
> > > correct and need to be fixed.
> > >
> > > Having list of bids for all files will be helpful in debugging.
> >
> > Will experienced users can/have to understand the output? If it's just for
> > debugging, I prefer not seeing it unless necessary.
>
> It's for debugging purposes only. Right now, a lot of times the merge
> code does not add an action for an ancestor. This leads to bid merge
> doing the wrong thing.
> This and showing number of ancestors in this debug output is meant to
> track down such cases where `manifestmerge()` is missing adding action
> for a file for some ancestors.

Okay, then let's switch to ui.debug() and leave the ui.note() messages
unmodified.
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel