Patchwork [3,of,3] py3: add test to show `hg merge` works

login
register
mail settings
Submitter Pulkit Goyal
Date June 10, 2017, 8:21 a.m.
Message ID <5670e6840252c312bd48.1497082915@workspace>
Download mbox | patch
Permalink /patch/21308/
State Accepted
Headers show

Comments

Pulkit Goyal - June 10, 2017, 8:21 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1496862836 -19800
#      Thu Jun 08 00:43:56 2017 +0530
# Node ID 5670e6840252c312bd488133e1cdf42729c12696
# Parent  36150d28b8a1d517c531542476329b47c18f49c2
py3: add test to show `hg merge` works

I don't think all cases of merge works, simple one like this works.
Augie Fackler - June 10, 2017, 2:03 p.m.
queued these, many thanks 

> On Jun 10, 2017, at 4:21 AM, Pulkit Goyal <7895pulkit@gmail.com> wrote:
> 
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1496862836 -19800
> #      Thu Jun 08 00:43:56 2017 +0530
> # Node ID 5670e6840252c312bd488133e1cdf42729c12696
> # Parent  36150d28b8a1d517c531542476329b47c18f49c2
> py3: add test to show `hg merge` works
> 
> I don't think all cases of merge works, simple one like this works.
> 
> diff --git a/tests/test-py3-commands.t b/tests/test-py3-commands.t
> --- a/tests/test-py3-commands.t
> +++ b/tests/test-py3-commands.t
> @@ -229,3 +229,56 @@
>   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>   $ hg identify
>   71c96e924262
> +  $ touch xyz
> +  $ echo "Hello" > xyz
> +  $ hg commit -A -m "A new commit"
> +  adding xyz
> +  created new head
> +  $ hg log -G
> +  @  changeset:   2:9bea3afb74fd
> +  |  tag:         tip
> +  |  parent:      0:71c96e924262
> +  |  user:        test
> +  |  date:        Thu Jan 01 00:00:00 1970 +0000
> +  |  summary:     A new commit
> +  |
> +  | o  changeset:   1:e1e9167203d4
> +  |/   user:        test
> +  |    date:        Thu Jan 01 00:00:00 1970 +0000
> +  |    summary:     message
> +  |
> +  o  changeset:   0:71c96e924262
> +     user:        test
> +     date:        Thu Jan 01 00:00:00 1970 +0000
> +     summary:     commit performed in Python 3
> +  
> +  $ hg merge
> +  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  (branch merge, don't forget to commit)
> +
> +  $ hg commit -m "Merge"
> +  $ hg log -G
> +  @    changeset:   3:bddd5e1adf68
> +  |\   tag:         tip
> +  | |  parent:      2:9bea3afb74fd
> +  | |  parent:      1:e1e9167203d4
> +  | |  user:        test
> +  | |  date:        Thu Jan 01 00:00:00 1970 +0000
> +  | |  summary:     Merge
> +  | |
> +  | o  changeset:   2:9bea3afb74fd
> +  | |  parent:      0:71c96e924262
> +  | |  user:        test
> +  | |  date:        Thu Jan 01 00:00:00 1970 +0000
> +  | |  summary:     A new commit
> +  | |
> +  o |  changeset:   1:e1e9167203d4
> +  |/   user:        test
> +  |    date:        Thu Jan 01 00:00:00 1970 +0000
> +  |    summary:     message
> +  |
> +  o  changeset:   0:71c96e924262
> +     user:        test
> +     date:        Thu Jan 01 00:00:00 1970 +0000
> +     summary:     commit performed in Python 3
> +  
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Yuya Nishihara - June 11, 2017, 3:43 a.m.
On Sat, 10 Jun 2017 13:51:55 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1496862836 -19800
> #      Thu Jun 08 00:43:56 2017 +0530
> # Node ID 5670e6840252c312bd488133e1cdf42729c12696
> # Parent  36150d28b8a1d517c531542476329b47c18f49c2
> py3: add test to show `hg merge` works

> +  $ hg merge

Here 'hg' is py2. You'll need $PYTHON3 $HGBIN.
Yuya Nishihara - June 11, 2017, 4:23 a.m.
On Sun, 11 Jun 2017 12:43:51 +0900, Yuya Nishihara wrote:
> On Sat, 10 Jun 2017 13:51:55 +0530, Pulkit Goyal wrote:
> > # HG changeset patch
> > # User Pulkit Goyal <7895pulkit@gmail.com>
> > # Date 1496862836 -19800
> > #      Thu Jun 08 00:43:56 2017 +0530
> > # Node ID 5670e6840252c312bd488133e1cdf42729c12696
> > # Parent  36150d28b8a1d517c531542476329b47c18f49c2
> > py3: add test to show `hg merge` works
> 
> > +  $ hg merge
> 
> Here 'hg' is py2. You'll need $PYTHON3 $HGBIN.

Actually it doesn't work on Python 3, so I'll drop this patch for now.

   $ $PYTHON3 $HGBIN merge
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  (branch merge, don't forget to commit)
+  ** unknown exception encountered, please report by visiting
+  ** https://mercurial-scm.org/wiki/BugTracker
+  ** Python 3.5.3+ (default, Jun  7 2017, 23:23:48) [GCC 6.3.0 20170516]
+  ** Mercurial Distributed SCM (version 4.2.1+614-0d435f4096ea+20170611)
+  ** Extensions loaded:
+  Traceback (most recent call last):
+    File "bin/hg", line 45, in <module>
+      mercurial.dispatch.run()
+    File "lib/python/mercurial/dispatch.py", line 86, in run
+      status = (dispatch(req) or 0) & 255
+    File "lib/python/mercurial/dispatch.py", line 167, in dispatch
+      ret = _runcatch(req)
+    File "lib/python/mercurial/dispatch.py", line 307, in _runcatch
+      return _callcatch(ui, _runcatchfunc)
+    File "lib/python/mercurial/dispatch.py", line 315, in _callcatch
+      return scmutil.callcatch(ui, func)
+    File "lib/python/mercurial/scmutil.py", line 145, in callcatch
+      return func()
+    File "lib/python/mercurial/dispatch.py", line 297, in _runcatchfunc
+      return _dispatch(req)
+    File "lib/python/mercurial/dispatch.py", line 924, in _dispatch
+      cmdpats, cmdoptions)
+    File "lib/python/mercurial/dispatch.py", line 663, in runcommand
+      ret = _runcommand(ui, options, cmd, d)
+    File "lib/python/mercurial/dispatch.py", line 932, in _runcommand
+      return cmdfunc()
+    File "lib/python/mercurial/dispatch.py", line 921, in <lambda>
+      d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
+    File "lib/python/mercurial/util.py", line 1064, in check
+      return func(*args, **kwargs)
+    File "lib/python/mercurial/commands.py", line 3591, in merge
+      labels=labels)
+    File "lib/python/mercurial/hg.py", line 811, in merge
+      labels=labels)
+    File "lib/python/mercurial/merge.py", line 1623, in update
+      followcopies, matcher=matcher, mergeforce=mergeforce)
+    File "lib/python/mercurial/merge.py", line 984, in calculateupdates
+      acceptremote, followcopies)
+    File "lib/python/mercurial/merge.py", line 807, in manifestmerge
+      ret = copies.mergecopies(repo, wctx, p2, pa)
+    File "lib/python/mercurial/copies.py", line 417, in mergecopies
+      _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, data1)
+    File "lib/python/mercurial/copies.py", line 685, in _checkcopies
+      if of in mta:
+    File "lib/python/mercurial/manifest.py", line 445, in __contains__
+      return key in self._lm
+    File "lib/python/mercurial/manifest.py", line 251, in __contains__
+      return self.bsearch(key) != -1
+    File "lib/python/mercurial/manifest.py", line 220, in bsearch
+      r = _cmp(key, candidate)
+    File "lib/python/mercurial/manifest.py", line 166, in _cmp
+      return (a > b) - (a < b)
+  TypeError: unorderable types: NoneType() > bytes()
+  [1]

Patch

diff --git a/tests/test-py3-commands.t b/tests/test-py3-commands.t
--- a/tests/test-py3-commands.t
+++ b/tests/test-py3-commands.t
@@ -229,3 +229,56 @@ 
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg identify
   71c96e924262
+  $ touch xyz
+  $ echo "Hello" > xyz
+  $ hg commit -A -m "A new commit"
+  adding xyz
+  created new head
+  $ hg log -G
+  @  changeset:   2:9bea3afb74fd
+  |  tag:         tip
+  |  parent:      0:71c96e924262
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A new commit
+  |
+  | o  changeset:   1:e1e9167203d4
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     message
+  |
+  o  changeset:   0:71c96e924262
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     commit performed in Python 3
+  
+  $ hg merge
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ hg commit -m "Merge"
+  $ hg log -G
+  @    changeset:   3:bddd5e1adf68
+  |\   tag:         tip
+  | |  parent:      2:9bea3afb74fd
+  | |  parent:      1:e1e9167203d4
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     Merge
+  | |
+  | o  changeset:   2:9bea3afb74fd
+  | |  parent:      0:71c96e924262
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     A new commit
+  | |
+  o |  changeset:   1:e1e9167203d4
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     message
+  |
+  o  changeset:   0:71c96e924262
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     commit performed in Python 3
+