mercurial@45414: 2 new changesets

2020-09-09 Thread Mercurial Commits
2 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/8ddbb75bad09
changeset:   45413:8ddbb75bad09
parent:  45411:a42999f611ff
user:Augie Fackler 
date:Mon Sep 07 15:31:34 2020 -0400
summary: git: convert tz offset to int (issue6359)

https://www.mercurial-scm.org/repo/hg/rev/66a10bd1b8db
changeset:   45414:66a10bd1b8db
bookmark:@
tag: tip
user:Augie Fackler 
date:Mon Sep 07 15:46:56 2020 -0400
summary: git: restore basic functionality after b3040b6739ce

-- 
Repository URL: https://www.mercurial-scm.org/repo/hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@45412: new changeset (1 on stable)

2020-09-09 Thread Mercurial Commits
New changeset (1 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/aaeccdb6e654
changeset:   45412:aaeccdb6e654
branch:  stable
tag: tip
parent:  45398:d58a205d0672
user:Matt Harbison 
date:Fri Sep 04 15:21:02 2020 -0400
summary: repoview: pin revisions for `local` and `other` when a merge is 
active

-- 
Repository URL: https://www.mercurial-scm.org/repo/hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 2] test-grep: document that trivially moved lines might not be detected

2020-09-09 Thread Augie Fackler
queued, thanks

> On Sep 9, 2020, at 08:20, Yuya Nishihara  wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1599568690 -32400
> #  Tue Sep 08 21:38:10 2020 +0900
> # Node ID cc233fb2375feef75d3f9619ed69cd5d5dea89dd
> # Parent  89d2c8f8bb4f5bfda272d2665ebcacd98e273d25
> test-grep: document that trivially moved lines might not be detected
> 
> I'm not going to fix this. I just learned "grep --diff" does clever thing
> than a simple grep(patch.diff(context=0)), and I think it's better to
> document how things work.
> 
> diff --git a/tests/test-grep.t b/tests/test-grep.t
> --- a/tests/test-grep.t
> +++ b/tests/test-grep.t
> @@ -640,6 +640,49 @@ revisions printed, just their order.
> 
>   $ cd ..
> 
> +Moved line may not be collected by "grep --diff" since it first filters
> +the contents to be diffed by the pattern. (i.e.
> +"diff <(grep pat a) <(grep pat b)", not "diff a b | grep pat".)
> +This is much faster than generating full diff per revision.
> +
> +  $ hg init moved-line
> +  $ cd moved-line
> +  $ cat <<'EOF' > a
> +  > foo
> +  > bar
> +  > baz
> +  > EOF
> +  $ hg ci -Am initial
> +  adding a
> +  $ cat <<'EOF' > a
> +  > bar
> +  > baz
> +  > foo
> +  > EOF
> +  $ hg ci -m reorder
> +
> +  $ hg diff -c 1
> +  diff -r a593cc55e81b -r 69789a3b6e80 a
> +  --- a/aThu Jan 01 00:00:00 1970 +
> +  +++ b/aThu Jan 01 00:00:00 1970 +
> +  @@ -1,3 +1,3 @@
> +  -foo
> +   bar
> +   baz
> +  +foo
> +
> + can't find the move of "foo" at the revision 1:
> +
> +  $ hg grep --diff foo -r1
> +  [1]
> +
> + "bar" isn't moved at the revisoin 1:
> +
> +  $ hg grep --diff bar -r1
> +  [1]
> +
> +  $ cd ..
> +
> Test for showing working of allfiles flag
> 
>   $ hg init sng
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] revset: remove indirect indexing of status tuple

2020-09-09 Thread Augie Fackler
queued, thanks

> On Sep 9, 2020, at 08:17, Yuya Nishihara  wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1599619911 -32400
> #  Wed Sep 09 11:51:51 2020 +0900
> # Node ID 89d2c8f8bb4f5bfda272d2665ebcacd98e273d25
> # Parent  0babbc33baec093b9119be36ec535edb8a12b3b8
> revset: remove indirect indexing of status tuple
> 
> Just use the attribute name.
> 
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -411,7 +411,7 @@ def adds(repo, subset, x):
> """
> # i18n: "adds" is a keyword
> pat = getstring(x, _(b"adds requires a pattern"))
> -return checkstatus(repo, subset, pat, 1)
> +return checkstatus(repo, subset, pat, 'added')
> 
> 
> @predicate(b'ancestor(*changeset)', safe=True, weight=0.5)
> @@ -681,12 +681,8 @@ def bundle(repo, subset, x):
> 
> def checkstatus(repo, subset, pat, field):
> """Helper for status-related revsets (adds, removes, modifies).
> -The field parameter says which kind is desired:
> -0: modified
> -1: added
> -2: removed
> +The field parameter says which kind is desired.
> """
> -label = {0: 'modified', 1: 'added', 2: 'removed'}[field]
> hasset = matchmod.patkind(pat) == b'set'
> 
> mcache = [None]
> @@ -707,7 +703,7 @@ def checkstatus(repo, subset, pat, field
> else:
> if not any(m(f) for f in c.files()):
> return False
> -files = getattr(repo.status(c.p1().node(), c.node()), label)
> +files = getattr(repo.status(c.p1().node(), c.node()), field)
> if fname is not None:
> if fname in files:
> return True
> @@ -715,7 +711,9 @@ def checkstatus(repo, subset, pat, field
> if any(m(f) for f in files):
> return True
> 
> -return subset.filter(matches, condrepr=(b'', field, pat))
> +return subset.filter(
> +matches, condrepr=(b'', pycompat.sysbytes(field), pat)
> +)
> 
> 
> def _children(repo, subset, parentset):
> @@ -1631,7 +1629,7 @@ def modifies(repo, subset, x):
> """
> # i18n: "modifies" is a keyword
> pat = getstring(x, _(b"modifies requires a pattern"))
> -return checkstatus(repo, subset, pat, 0)
> +return checkstatus(repo, subset, pat, 'modified')
> 
> 
> @predicate(b'named(namespace)')
> @@ -2090,7 +2088,7 @@ def removes(repo, subset, x):
> """
> # i18n: "removes" is a keyword
> pat = getstring(x, _(b"removes requires a pattern"))
> -return checkstatus(repo, subset, pat, 2)
> +return checkstatus(repo, subset, pat, 'removed')
> 
> 
> @predicate(b'rev(number)', safe=True)
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9004: hgdemandimport: bypass demandimport for _ast module (issue6407)

2020-09-09 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is broken on Python 3.9rc1, and while it sounds like there may be
  a fix in Python, we probably also should have this workaround in place
  in hg. See the bug for more details (including on bugs at redhat and
  b.p.o).

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  hgdemandimport/__init__.py

CHANGE DETAILS

diff --git a/hgdemandimport/__init__.py b/hgdemandimport/__init__.py
--- a/hgdemandimport/__init__.py
+++ b/hgdemandimport/__init__.py
@@ -46,6 +46,7 @@
 # setuptools' pkg_resources.py expects "from __main__ import x" to
 # raise ImportError if x not defined
 '__main__',
+'_ast', # https://bugs.python.org/issue41631
 '_ssl',  # conditional imports in the stdlib, issue1964
 '_sre',  # issue4920
 'rfc822',



To: durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9003: merge: store cases when a file is absent post merge in commitinfo

2020-09-09 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Some merges can result in file being absent form working directory. This can 
be
  one of file was kept deleted or file was removed by merge code.
  
  User might revert the file back before committing. In such cases we will like 
to
  have better handling and create new filenodes.
  
  We store this info in mergestate as commitinfo so that we can use it while
  committing to create new filenode if required.
  
  This also adds some `hg debugmergestate` calls to show that extras are stored 
in
  mergestate.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/merge.py
  tests/test-merge-criss-cross.t

CHANGE DETAILS

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
@@ -661,6 +661,8 @@
   (branch merge, don't forget to commit)
   $ ls -1
   other-file
+  $ hg debugmergestate
+  no merge state found
 
 (merging a deletion with keeping → conflict)
 BROKEN: this should result in conflict
@@ -673,6 +675,8 @@
   $ ls -1
   other-file
   the-file
+  $ hg debugmergestate
+  no merge state found
 
 (merging a deletion with keeping → conflict)
 BROKEN: this should result in conflict
@@ -684,6 +688,10 @@
   (branch merge, don't forget to commit)
   $ ls -1
   other-file
+  $ hg debugmergestate
+  local (working copy): adfd88e5d7d3d3e22bdd26512991ee64d59c1d8f
+  other (merge rev): 5e3eccec60d88f94a7ba57c351f32cb24c15fe0c
+  extra: the-file (FORCE_NEW_FILENODE = yes)
 
 (merging two deletion together → no conflict)
 
@@ -694,6 +702,8 @@
   (branch merge, don't forget to commit)
   $ ls -1
   other-file
+  $ hg debugmergestate
+  no merge state found
 
 (merging a deletion with keeping → conflict)
 BROKEN: this should result in conflict
@@ -706,6 +716,8 @@
   $ ls -1
   other-file
   the-file
+  $ hg debugmergestate
+  no merge state found
 
 (merging a deletion with keeping → conflict)
 BROKEN: this should result in conflict
@@ -717,6 +729,10 @@
   (branch merge, don't forget to commit)
   $ ls -1
   other-file
+  $ hg debugmergestate
+  local (working copy): a4e0e44229dc130be2915b92c957c093f8c7ee3e
+  other (merge rev): 5e3eccec60d88f94a7ba57c351f32cb24c15fe0c
+  extra: the-file (FORCE_NEW_FILENODE = yes)
 
 (merging two "keeping" together → no conflict)
 
@@ -728,6 +744,10 @@
   $ ls -1
   other-file
   the-file
+  $ hg debugmergestate
+  local (working copy): 5e3eccec60d88f94a7ba57c351f32cb24c15fe0c
+  other (merge rev): 38a4c3e7cac8c294ecb0a7a85a05464e9836ca78
+  extra: the-file (filenode-source = other)
 
 (merging a deletion with keeping → conflict)
 BROKEN: this should result in conflict
@@ -740,6 +760,8 @@
   $ ls -1
   other-file
   the-file
+  $ hg debugmergestate
+  no merge state found
 
 (merging a deletion with keeping → conflict)
 BROKEN: this should result in conflict
@@ -752,6 +774,10 @@
   $ ls -1
   other-file
   the-file
+  $ hg debugmergestate
+  local (working copy): 5e3eccec60d88f94a7ba57c351f32cb24c15fe0c
+  other (merge rev): a4e0e44229dc130be2915b92c957c093f8c7ee3e
+  extra: the-file (FORCE_NEW_FILENODE = yes)
 
 (merging two "keeping" together → no conflict)
 
@@ -763,6 +789,8 @@
   $ ls -1
   other-file
   the-file
+  $ hg debugmergestate
+  no merge state found
 
 (merging a deletion with keeping → conflict)
 BROKEN: this should result in conflict
@@ -775,6 +803,8 @@
   $ ls -1
   other-file
   the-file
+  $ hg debugmergestate
+  no merge state found
 
 (merging a deletion with keeping → conflict)
 BROKEN: this should result in conflict
@@ -787,3 +817,5 @@
   $ ls -1
   other-file
   the-file
+  $ hg debugmergestate
+  no merge state found
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -949,6 +949,13 @@
 mresult.addfile(
 f, mergestatemod.ACTION_REMOVE, None, b'other deleted',
 )
+if branchmerge:
+# the file must be absent after merging,
+# howeber the user might make
+# the file reappear using revert and if they does,
+# we force create a new node
+mresult.addcommitinfo(f, b'FORCE_NEW_FILENODE', b'yes')
+
 else:  # file not in ancestor, not in remote
 rename_found = False
 for source, dest in branch_copies1.dirmove.items():
@@ -1088,6 +1095,12 @@
 None,
 b'local not present, remote unchanged',
 )
+if branchmerge:
+# the file must be absent after merging
+# however the user might make
+# the file reappear using revert and if they does,
+   

D9002: mergestate: introduce a new ACTION_KEEP_NEW

2020-09-09 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `ACTION_KEEP` is overloaded and it's hard to figure out how we end up with 
this
  KEEP, what was the state of things.
  
  In a previous patch, we introduced `ACTION_KEEP_ABSENT` which represents files
  which are kept absent in the working directory.
  
  There is another special case where we keep the file when it's not present on
  both ancestor and remote side. We introduce a dedicated action for that.
  
  The goal is to use these information to make bid merge smarter.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/merge.py
  mercurial/mergestate.py
  tests/test-merge-criss-cross.t

CHANGE DETAILS

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
@@ -446,8 +446,8 @@
   resolving manifests
branchmerge: True, force: False, partial: False
ancestor: 11b5b303e36c, local: c0ef19750a22+, remote: 6ca01f7342b9
-   d1/a: ancestor missing, remote missing -> k
-   d1/b: ancestor missing, remote missing -> k
+   d1/a: ancestor missing, remote missing -> kn
+   d1/b: ancestor missing, remote missing -> kn
d2/b: remote created -> g
   
   calculating bids for ancestor 154e6000f54e
@@ -468,14 +468,14 @@
   auction for merging merge bids (2 ancestors)
d1/a:
  list of bids:
-   ancestor missing, remote missing -> k
+   ancestor missing, remote missing -> kn
other deleted -> r
- picking 'keep' action
+   d1/a: picking 'keep new' action
d1/b:
  list of bids:
-   ancestor missing, remote missing -> k
+   ancestor missing, remote missing -> kn
other deleted -> r
- picking 'keep' action
+   d1/b: picking 'keep new' action
d2/b:
  list of bids:
remote created -> g
@@ -485,8 +485,8 @@
   
d2/b: remote created -> g
   getting d2/b
-   d1/a: ancestor missing, remote missing -> k
-   d1/b: ancestor missing, remote missing -> k
+   d1/a: ancestor missing, remote missing -> kn
+   d1/b: ancestor missing, remote missing -> kn
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
 
diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -124,6 +124,9 @@
 # keep it absent (absent means file not present, it can be a result
 # of file deletion, rename etc.)
 ACTION_KEEP_ABSENT = b'ka'
+# the file is absent on the ancestor and remote side of the merge
+# hence this file is new and we should keep it
+ACTION_KEEP_NEW = b'kn'
 ACTION_EXEC = b'e'
 ACTION_CREATED_MERGE = b'cm'
 
@@ -845,6 +848,10 @@
 for f, args, msg in actions.get(ACTION_KEEP_ABSENT, []):
 pass
 
+# keep new
+for f, args, msg in actions.get(ACTION_KEEP_NEW, []):
+pass
+
 # get
 for f, args, msg in actions.get(ACTION_GET, []):
 if branchmerge:
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -566,6 +566,7 @@
 NO_OP_ACTIONS = (
 mergestatemod.ACTION_KEEP,
 mergestatemod.ACTION_KEEP_ABSENT,
+mergestatemod.ACTION_KEEP_NEW,
 )
 
 def __init__(self):
@@ -964,7 +965,7 @@
 if not rename_found:
 mresult.addfile(
 f,
-mergestatemod.ACTION_KEEP,
+mergestatemod.ACTION_KEEP_NEW,
 None,
 b'ancestor missing, remote missing',
 )
@@ -1237,6 +1238,11 @@
 repo.ui.note(_(b" %s: picking 'keep absent' action\n") % f)
 mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_ABSENT][0])
 continue
+# If keep new is an option, let's just do that
+if mergestatemod.ACTION_KEEP_NEW in bids:
+repo.ui.note(_(b" %s: picking 'keep new' action\n") % f)
+mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_NEW][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]
@@ -1537,15 +1543,9 @@
 progress.increment(item=f)
 
 # keep (noop, just log it)
-for f, args, msg in mresult.getactions(
-(mergestatemod.ACTION_KEEP,), sort=True
-):
-repo.ui.debug(b" %s: %s -> k\n" % (f, msg))
-# no progress
-for f, args, msg in mresult.getactions(
-(mergestatemod.ACTION_KEEP_ABSENT,), sort=True
-):
-repo.ui.debug(b" %s: %s -> ka\n" % (f, msg))
+for a in mergeresult.NO_OP_ACTIONS:
+for f, args, msg in mresult.getactions((a,), sort=True):
+

[PATCH 2 of 2] grep: fix hash(linestate) to not include linenum

2020-09-09 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1599619278 -32400
#  Wed Sep 09 11:41:18 2020 +0900
# Node ID d9a83a225c54affd48b570c486bd4f08a6877252
# Parent  cc233fb2375feef75d3f9619ed69cd5d5dea89dd
grep: fix hash(linestate) to not include linenum

linestate.__eq__() just compares the line values whereas __hash__() does
hash both self.line and self.linenum, which violates the rule. __hash__()
was added at fb502719c75c, "python 2.6 compatibility: add __hash__ to
classes that have __eq__" with no additional remarks, so this would probably
be a simple mistake.

The test output changed because difflib.SequenceMatcher() internally uses
a dict. As you can see, the line "export" is unchanged at the revision 2,
so the new output is correct.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3400,7 +3400,7 @@ def grep(ui, repo, pattern, *pats, **opt
 self.colend = colend
 
 def __hash__(self):
-return hash((self.linenum, self.line))
+return hash(self.line)
 
 def __eq__(self, other):
 return self.line == other.line
diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -321,14 +321,61 @@ simple JSON without matching lines
}
   ]
 
+diff of each revision for reference
+
+  $ hg log -p -T'== rev: {rev} ==\n'
+  == rev: 4 ==
+  diff -r 95040cfd017d -r 914fa752cdea port
+  --- a/port   Thu Jan 01 00:00:03 1970 +
+  +++ b/port   Thu Jan 01 00:00:04 1970 +
+  @@ -1,4 +1,3 @@
+   export
+   vaportight
+   import/export
+  -import/export
+  
+  == rev: 3 ==
+  diff -r 3b325e3481a1 -r 95040cfd017d port
+  --- a/port   Thu Jan 01 00:00:02 1970 +
+  +++ b/port   Thu Jan 01 00:00:03 1970 +
+  @@ -1,3 +1,4 @@
+   export
+   vaportight
+   import/export
+  +import/export
+  
+  == rev: 2 ==
+  diff -r 8b20f75c1585 -r 3b325e3481a1 port
+  --- a/port   Thu Jan 01 00:00:01 1970 +
+  +++ b/port   Thu Jan 01 00:00:02 1970 +
+  @@ -1,2 +1,3 @@
+  -import
+   export
+  +vaportight
+  +import/export
+  
+  == rev: 1 ==
+  diff -r f31323c92170 -r 8b20f75c1585 port
+  --- a/port   Thu Jan 01 00:00:00 1970 +
+  +++ b/port   Thu Jan 01 00:00:01 1970 +
+  @@ -1,1 +1,2 @@
+   import
+  +export
+  
+  == rev: 0 ==
+  diff -r  -r f31323c92170 port
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/port   Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +import
+  
+
 all
 
   $ hg grep --traceback --all -nu port port
   port:4:4:-:spam:import/export
   port:3:4:+:eggs:import/export
   port:2:1:-:spam:import
-  port:2:2:-:spam:export
-  port:2:1:+:spam:export
   port:2:2:+:spam:vaportight
   port:2:3:+:spam:import/export
   port:1:2:+:eggs:export
@@ -369,26 +416,6 @@ all JSON
 "user": "spam"
},
{
-"change": "-",
-"date": [2, 0],
-"lineno": 2,
-"node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
-"path": "port",
-"rev": 2,
-"texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": 
"port"}],
-"user": "spam"
-   },
-   {
-"change": "+",
-"date": [2, 0],
-"lineno": 1,
-"node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
-"path": "port",
-"rev": 2,
-"texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": 
"port"}],
-"user": "spam"
-   },
-   {
 "change": "+",
 "date": [2, 0],
 "lineno": 2,
@@ -460,8 +487,6 @@ follow
   port:4:4:-:spam:import/export
   port:3:4:+:eggs:import/export
   port:2:1:-:spam:import
-  port:2:2:-:spam:export
-  port:2:1:+:spam:export
   port:2:2:+:spam:vaportight
   port:2:3:+:spam:import/export
   port:1:2:+:eggs:export
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2] test-grep: document that trivially moved lines might not be detected

2020-09-09 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1599568690 -32400
#  Tue Sep 08 21:38:10 2020 +0900
# Node ID cc233fb2375feef75d3f9619ed69cd5d5dea89dd
# Parent  89d2c8f8bb4f5bfda272d2665ebcacd98e273d25
test-grep: document that trivially moved lines might not be detected

I'm not going to fix this. I just learned "grep --diff" does clever thing
than a simple grep(patch.diff(context=0)), and I think it's better to
document how things work.

diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -640,6 +640,49 @@ revisions printed, just their order.
 
   $ cd ..
 
+Moved line may not be collected by "grep --diff" since it first filters
+the contents to be diffed by the pattern. (i.e.
+"diff <(grep pat a) <(grep pat b)", not "diff a b | grep pat".)
+This is much faster than generating full diff per revision.
+
+  $ hg init moved-line
+  $ cd moved-line
+  $ cat <<'EOF' > a
+  > foo
+  > bar
+  > baz
+  > EOF
+  $ hg ci -Am initial
+  adding a
+  $ cat <<'EOF' > a
+  > bar
+  > baz
+  > foo
+  > EOF
+  $ hg ci -m reorder
+
+  $ hg diff -c 1
+  diff -r a593cc55e81b -r 69789a3b6e80 a
+  --- a/a  Thu Jan 01 00:00:00 1970 +
+  +++ b/a  Thu Jan 01 00:00:00 1970 +
+  @@ -1,3 +1,3 @@
+  -foo
+   bar
+   baz
+  +foo
+
+ can't find the move of "foo" at the revision 1:
+
+  $ hg grep --diff foo -r1
+  [1]
+
+ "bar" isn't moved at the revisoin 1:
+
+  $ hg grep --diff bar -r1
+  [1]
+
+  $ cd ..
+
 Test for showing working of allfiles flag
 
   $ hg init sng
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] revset: remove indirect indexing of status tuple

2020-09-09 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1599619911 -32400
#  Wed Sep 09 11:51:51 2020 +0900
# Node ID 89d2c8f8bb4f5bfda272d2665ebcacd98e273d25
# Parent  0babbc33baec093b9119be36ec535edb8a12b3b8
revset: remove indirect indexing of status tuple

Just use the attribute name.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -411,7 +411,7 @@ def adds(repo, subset, x):
 """
 # i18n: "adds" is a keyword
 pat = getstring(x, _(b"adds requires a pattern"))
-return checkstatus(repo, subset, pat, 1)
+return checkstatus(repo, subset, pat, 'added')
 
 
 @predicate(b'ancestor(*changeset)', safe=True, weight=0.5)
@@ -681,12 +681,8 @@ def bundle(repo, subset, x):
 
 def checkstatus(repo, subset, pat, field):
 """Helper for status-related revsets (adds, removes, modifies).
-The field parameter says which kind is desired:
-0: modified
-1: added
-2: removed
+The field parameter says which kind is desired.
 """
-label = {0: 'modified', 1: 'added', 2: 'removed'}[field]
 hasset = matchmod.patkind(pat) == b'set'
 
 mcache = [None]
@@ -707,7 +703,7 @@ def checkstatus(repo, subset, pat, field
 else:
 if not any(m(f) for f in c.files()):
 return False
-files = getattr(repo.status(c.p1().node(), c.node()), label)
+files = getattr(repo.status(c.p1().node(), c.node()), field)
 if fname is not None:
 if fname in files:
 return True
@@ -715,7 +711,9 @@ def checkstatus(repo, subset, pat, field
 if any(m(f) for f in files):
 return True
 
-return subset.filter(matches, condrepr=(b'', field, pat))
+return subset.filter(
+matches, condrepr=(b'', pycompat.sysbytes(field), pat)
+)
 
 
 def _children(repo, subset, parentset):
@@ -1631,7 +1629,7 @@ def modifies(repo, subset, x):
 """
 # i18n: "modifies" is a keyword
 pat = getstring(x, _(b"modifies requires a pattern"))
-return checkstatus(repo, subset, pat, 0)
+return checkstatus(repo, subset, pat, 'modified')
 
 
 @predicate(b'named(namespace)')
@@ -2090,7 +2088,7 @@ def removes(repo, subset, x):
 """
 # i18n: "removes" is a keyword
 pat = getstring(x, _(b"removes requires a pattern"))
-return checkstatus(repo, subset, pat, 2)
+return checkstatus(repo, subset, pat, 'removed')
 
 
 @predicate(b'rev(number)', safe=True)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@45411: new changeset

2020-09-09 Thread Mercurial Commits
New changeset in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/a42999f611ff
changeset:   45411:a42999f611ff
bookmark:@
tag: tip
parent:  45410:2d08dcf8fd9e
parent:  45398:d58a205d0672
user:Augie Fackler 
date:Mon Sep 07 15:20:31 2020 -0400
summary: merge with stable

-- 
Repository URL: https://www.mercurial-scm.org/repo/hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel