D12002: precheck: fix false warning about content-divergence creation

2022-01-16 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Before this patch, if we try to `hg prune` (without any successors) an
  already obsoleted cset which has at least one successor, it would false
  warn about new content-divergence. As we know pruning cset without any
  successors can not create any divergence.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/rewriteutil.py

CHANGE DETAILS

diff --git a/mercurial/rewriteutil.py b/mercurial/rewriteutil.py
--- a/mercurial/rewriteutil.py
+++ b/mercurial/rewriteutil.py
@@ -49,7 +49,7 @@
 return summary
 
 
-def precheck(repo, revs, action=b'rewrite'):
+def precheck(repo, revs, action=b'rewrite', successors=None):
 """check if revs can be rewritten
 action is used to control the error message.
 
@@ -85,6 +85,10 @@
 hint=hint,
 )
 
+# Adding a prune marker (A, ()) to obsstore can't be diverging
+if action == b'prune' and not successors:
+return
+
 if not obsolete.isenabled(repo, obsolete.allowdivergenceopt):
 new_divergence = _find_new_divergence(repo, revs)
 if new_divergence:



To: khanchi97, #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


D11619: hg: use dict.get() instead, to prevent KeyError

2021-10-08 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/debugcommands.py
  mercurial/hg.py

CHANGE DETAILS

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1285,7 +1285,7 @@
 if revs:
 revs = [other.lookup(rev) for rev in revs]
 other, chlist, cleanupfn = bundlerepo.getremotechanges(
-ui, repo, other, revs, opts[b"bundle"], opts[b"force"]
+ui, repo, other, revs, opts.get(b"bundle"), opts.get(b"force")
 )
 
 if not chlist:
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -3905,7 +3905,12 @@
 with ui.silent():
 try:
 other, chlist, cleanupfn = bundlerepo.getremotechanges(
-ui, repo, other, revs, opts[b"bundle"], opts[b"force"]
+ui,
+repo,
+other,
+revs,
+opts.get(b"bundle"),
+opts.get(b"force"),
 )
 except error.LookupError:
 continue



To: khanchi97, #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


D10079: patch: fix a formatting issue

2021-02-26 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/patch.py

CHANGE DETAILS

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -3105,9 +3105,7 @@
 if binary and opts.git and not opts.nobinary:
 text = mdiff.b85diff(content1, content2)
 if text:
-header.append(
-b'index %s..%s' % (index1, index2)
-)
+header.append(b'index %s..%s' % (index1, index2))
 hunks = ((None, [text]),)
 else:
 if opts.git and opts.index > 0:



To: khanchi97, #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


D10067: tests: accept output changes by 33350debb480

2021-02-25 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  tests/test-diff-upgrade.t
  tests/test-diffstat.t
  tests/test-git-export.t
  tests/test-log-linerange.t

CHANGE DETAILS

diff --git a/tests/test-log-linerange.t b/tests/test-log-linerange.t
--- a/tests/test-log-linerange.t
+++ b/tests/test-log-linerange.t
@@ -1114,7 +1114,7 @@
   
   diff --git a/dir/binary b/dir/binary
   new file mode 100644
-  index 
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c2e1fbed209fe919b3f189a6a31950e9adf61e45
+  index 
..c2e1fbed209fe919b3f189a6a31950e9adf61e45
   GIT binary patch
   literal 17
   Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy
diff --git a/tests/test-git-export.t b/tests/test-git-export.t
--- a/tests/test-git-export.t
+++ b/tests/test-git-export.t
@@ -346,7 +346,7 @@
   $ cat b.diff
   diff --git a/binfile.bin b/binfile.bin
   new file mode 100644
-  index 
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9
+  index 
..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9
   GIT binary patch
   literal 593
   zc$@)I0https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10019: configitems: register an experimental evolve config

2021-02-18 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Config:
  
experimental.evolution.divergence-resolution-minimal=False (default)
  
  This experimental config gives user the flexibility to choose (in a special
  case of divergence) how they would like to resolve.
  
  Special case: when divergence is created by one side amended some changes
  and other relocated to an obsolete cset which has a successor as well.
  
  By default, evolution will set the successor of obsolete parent as resolution
  parent and will relocate both the divergent cset on it to perform 3-way merge.
  But if this config is set to True, it will set the obsolete parent as
  resolution parent, so now resolved cset will be orphan as it will be based on
  the obsolete parent. Some users might not like the evolve to automatically
  resolve this orphan instability as well (while they only wanted to resolve the
  divergence), which is why we are providing this config.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/configitems.py

CHANGE DETAILS

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -952,6 +952,11 @@
 )
 coreconfigitem(
 b'experimental',
+b'evolution.divergence-resolution-minimal',
+default=False,
+)
+coreconfigitem(
+b'experimental',
 b'log.topo',
 default=False,
 )



To: khanchi97, #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


D10001: patch: make diff --git to differentiate b/w file is empty or doesn't exists

2021-02-16 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Before this patch, as we didn't differentiate the two cases of a file in a 
context:
  
  1. File doesn't exists
  2. File is empty
  
  which causes the blob id to be same for both the cases.
  
  Now we use `nullhex` for a file which doesn't exists in a context (aligning 
it with
  the git diff format)
  
  Changes in test file reflect the fixed behavior.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/patch.py
  tests/test-diff-unified.t

CHANGE DETAILS

diff --git a/tests/test-diff-unified.t b/tests/test-diff-unified.t
--- a/tests/test-diff-unified.t
+++ b/tests/test-diff-unified.t
@@ -467,7 +467,7 @@
   $ hg ci -Am "empty a"
   adding a
   $ hg diff -c 0 --git --config experimental.extendedheader.index=full | grep 
index
-  index 
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
 100644
+  index 
..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
 100644
 
 Make sure `hg diff --git` differentiate "file was empty" and "file is removed"
 for git blob oids
@@ -476,6 +476,6 @@
   $ hg ci -Am "removed a"
   removing a
   $ hg diff -c 1 --git --config experimental.extendedheader.index=full | grep 
index
-  index 
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
 100644
+  index 
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..
 100644
 
   $ cd ..
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -20,6 +20,7 @@
 from .i18n import _
 from .node import (
 hex,
+nullhex,
 short,
 )
 from .pycompat import open
@@ -3099,11 +3100,13 @@
 
 ctx1, fctx1, path1, flag1, content1, date1 = data1
 ctx2, fctx2, path2, flag2, content2, date2 = data2
+index1 = _gitindex(content1) if path1 in ctx1 else nullhex
+index2 = _gitindex(content2) if path2 in ctx2 else nullhex
 if binary and opts.git and not opts.nobinary:
 text = mdiff.b85diff(content1, content2)
 if text:
 header.append(
-b'index %s..%s' % (_gitindex(content1), _gitindex(content2))
+b'index %s..%s' % (index1, index2)
 )
 hunks = ((None, [text]),)
 else:
@@ -3114,8 +3117,8 @@
 header.append(
 b'index %s..%s %s'
 % (
-_gitindex(content1)[0 : opts.index],
-_gitindex(content2)[0 : opts.index],
+index1[0 : opts.index],
+index2[0 : opts.index],
 _gitmode[flag],
 )
 )



To: khanchi97, #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


D10000: tests: add a test to demonstrate a bug in `hg diff --git` (issue6486)

2021-02-16 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Issue url: https://bz.mercurial-scm.org/show_bug.cgi?id=6486
  This will be fixed in next patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-diff-unified.t

CHANGE DETAILS

diff --git a/tests/test-diff-unified.t b/tests/test-diff-unified.t
--- a/tests/test-diff-unified.t
+++ b/tests/test-diff-unified.t
@@ -456,3 +456,26 @@
 .
 
   $ cd ..
+
+Make sure `hg diff --git` differentiate "file did not exists" and "file is 
empty"
+for git blob oids
+
+  $ hg init bloboids
+  $ cd bloboids
+
+  $ touch a
+  $ hg ci -Am "empty a"
+  adding a
+  $ hg diff -c 0 --git --config experimental.extendedheader.index=full | grep 
index
+  index 
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
 100644
+
+Make sure `hg diff --git` differentiate "file was empty" and "file is removed"
+for git blob oids
+
+  $ rm a
+  $ hg ci -Am "removed a"
+  removing a
+  $ hg diff -c 1 --git --config experimental.extendedheader.index=full | grep 
index
+  index 
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
 100644
+
+  $ cd ..



To: khanchi97, #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


D9659: rebase: handle the case when nothing to rebase (dry-run)

2020-12-26 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: martinvonz.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  In dry-run mode, even when there was no rebase in progress it tried
  to abort (for context, at the end of dry-run mode we abort the in-memory
  performed rebase) because we were not early checking if there was any rebase
  started.
  
  Changes in test file reflect the fixed behavior.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -342,9 +342,7 @@
   $ hg reb -r . -d '.^' -n
   starting dry-run rebase; repository will not be changed
   nothing to rebase
-  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
-  abort: no rebase in progress
-  [20]
+  [1]
 
 Check dryrun gives correct results when there is no conflict in rebasing
   $ hg rebase -s 2 -d 6 -n
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1139,13 +1139,16 @@
 try:
 overrides = {(b'rebase', b'singletransaction'): True}
 with ui.configoverride(overrides, b'rebase'):
-_origrebase(
+res = _origrebase(
 ui,
 repo,
 action,
 opts,
 rbsrt,
 )
+if res == _nothingtorebase():
+needsabort = False
+return res
 except error.ConflictResolutionRequired:
 ui.status(_(b'hit a merge conflict\n'))
 return 1



To: khanchi97, martinvonz, #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


D9658: rebase: add test to demonstrate an issue in dry-run

2020-12-26 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  In dry-run mode, the case when there is nothing to rebase
  is not handled correctly. Added test show that it try to
  abort a rebase while there is no rebase in progress.
  
  This will be fixed in next patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -338,6 +338,14 @@
   abort: cannot specify both --abort and --dry-run
   [10]
 
+When nothing to rebase
+  $ hg reb -r . -d '.^' -n
+  starting dry-run rebase; repository will not be changed
+  nothing to rebase
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
+  abort: no rebase in progress
+  [20]
+
 Check dryrun gives correct results when there is no conflict in rebasing
   $ hg rebase -s 2 -d 6 -n
   starting dry-run rebase; repository will not be changed



To: khanchi97, #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


D9442: help: fix a grammar/typo in hg help dates

2020-11-28 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/helptext/dates.txt

CHANGE DETAILS

diff --git a/mercurial/helptext/dates.txt b/mercurial/helptext/dates.txt
--- a/mercurial/helptext/dates.txt
+++ b/mercurial/helptext/dates.txt
@@ -36,4 +36,4 @@
 - ``DATE`` - on or after a given date/time
 - ``DATE to DATE`` - a date range, inclusive
-- ``-DAYS`` - within a given number of days of today
+- ``-DAYS`` - within a given number of days from today



To: khanchi97, #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


D9009: py3: fix bytes and str mixup in run-tests

2020-09-11 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3347,7 +3347,8 @@
 else:
 errpath = b'%s.err' % test['path']
 if self.options.outputdir:
-errpath = os.path.join(self.options.outputdir, errpath)
+self._outputdir = canonpath(_sys2bytes(self.options.outputdir))
+errpath = os.path.join(self._outputdir, errpath)
 return errpath
 
 def _getport(self, count):



To: khanchi97, #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


D8979: run-tests: extract logic to get errpath in a utility func

2020-09-02 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3248,15 +3248,7 @@
 if self.options.retest:
 retest_args = []
 for test in tests:
-if 'case' in test:
-# for multiple dimensions test cases
-casestr = b'#'.join(test['case'])
-errpath = b'%s#%s.err' % (test['path'], casestr)
-else:
-errpath = b'%s.err' % test['path']
-if self.options.outputdir:
-errpath = os.path.join(self.options.outputdir, errpath)
-
+errpath = self._geterrpath(test)
 if os.path.exists(errpath):
 retest_args.append(test)
 tests = retest_args
@@ -3276,13 +3268,7 @@
 orig = list(testdescs)
 while testdescs:
 desc = testdescs[0]
-# desc['path'] is a relative path
-if 'case' in desc:
-casestr = b'#'.join(desc['case'])
-errpath = b'%s#%s.err' % (desc['path'], casestr)
-else:
-errpath = b'%s.err' % desc['path']
-errpath = os.path.join(self._outputdir, errpath)
+errpath = self._geterrpath(desc)
 if os.path.exists(errpath):
 break
 testdescs.pop(0)
@@ -3352,6 +3338,18 @@
 if failed:
 return 1
 
+def _geterrpath(self, test):
+# test['path'] is a relative path
+if 'case' in test:
+# for multiple dimensions test cases
+casestr = b'#'.join(test['case'])
+errpath = b'%s#%s.err' % (test['path'], casestr)
+else:
+errpath = b'%s.err' % test['path']
+if self.options.outputdir:
+errpath = os.path.join(self.options.outputdir, errpath)
+return errpath
+
 def _getport(self, count):
 port = self._ports.get(count)  # do we have a cached entry?
 if port is None:



To: khanchi97, #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


D8964: test-run-tests.t: add a --retest test to demonstrate a fix in next patch

2020-08-27 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  As you see above the added lines, there was only one test failed.
  So the output should be:
"running 1 tests using 1 parallel processes"
  
  Next patch will be fixing this.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-run-tests.t

CHANGE DETAILS

diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -974,6 +974,25 @@
   python hash seed: * (glob)
   [1]
 
+  $ rt --retest
+  running 5 tests using 1 parallel processes 
+  
+  --- $TESTTMP/test-cases.t
+  +++ $TESTTMP/test-cases.t#b#c.err
+  @@ -6,5 +6,5 @@
+   #endif
+   #if b c
+ $ echo yes
+  -  no
+  +  yes
+   #endif
+  
+  ERROR: test-cases.t#b#c output changed
+  !
+  Failed test-cases.t#b#c: output changed
+  # Ran 5 tests, 4 skipped, 1 failed.
+  python hash seed: 1843801597
+  [1]
   $ rm test-cases.t#b#c.err
   $ rm test-cases.t
 



To: khanchi97, #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


D8963: test-run-tests.t: remove a sub-test since we are done with it

2020-08-27 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  removing test-failure.t to make sure that in next patch when
  we re-run failed tests using --retest, it won't get considered
  unnecessarily.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-run-tests.t

CHANGE DETAILS

diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -844,6 +844,8 @@
 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
 saved backup bundle to $TESTTMP/*.hg (glob)<
 
+  $ rm test-failure.t
+
 Race condition - test file was modified when test is running
 
   $ TESTRACEDIR=`pwd`



To: khanchi97, #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


D8938: run-tests: refactor filtering logic for --retest flag

2020-08-22 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  How I got to this:
  While re-running failed tests using --retest I noticed that the output:
"running x tests using y parallel processes".
  was not actually correct, because x was the total number of tests present
  in the directory, but it should be the number of failed tests. Although
  it would run only the failed tests and later will say that remaining tests
  were skipped.
  
  This patch change and move the logic for filtering failed test for
  --retest option and make sure that we create instances of
  class Test only for the tests we need to run.
  
  As mentioned in the deleted text (in this patch itself) the logic
  for --retest should be outside of TestSuite.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/run-tests.py
  tests/test-run-tests.t

CHANGE DETAILS

diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -497,7 +497,7 @@
 
 
   $ rt --retest
-  running 2 tests using 1 parallel processes 
+  running 1 tests using 1 parallel processes 
   
   --- $TESTTMP/test-failure.t
   +++ $TESTTMP/test-failure.t.err
@@ -512,7 +512,7 @@
   ERROR: test-failure.t output changed
   !
   Failed test-failure.t: output changed
-  # Ran 2 tests, 1 skipped, 1 failed.
+  # Ran 1 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
 
@@ -521,7 +521,7 @@
   $ mkdir output
   $ mv test-failure.t.err output
   $ rt --retest --outputdir output
-  running 2 tests using 1 parallel processes 
+  running 1 tests using 1 parallel processes 
   
   --- $TESTTMP/test-failure.t
   +++ $TESTTMP/output/test-failure.t.err
@@ -536,7 +536,7 @@
   ERROR: test-failure.t output changed
   !
   Failed test-failure.t: output changed
-  # Ran 2 tests, 1 skipped, 1 failed.
+  # Ran 1 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
 
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2336,7 +2336,6 @@
 jobs=1,
 whitelist=None,
 blacklist=None,
-retest=False,
 keywords=None,
 loop=False,
 runs_per_test=1,
@@ -2364,9 +2363,6 @@
 backwards compatible behavior which reports skipped tests as part
 of the results.
 
-retest denotes whether to retest failed tests. This arguably belongs
-outside of TestSuite.
-
 keywords denotes key words that will be used to filter which tests
 to execute. This arguably belongs outside of TestSuite.
 
@@ -2377,7 +2373,6 @@
 self._jobs = jobs
 self._whitelist = whitelist
 self._blacklist = blacklist
-self._retest = retest
 self._keywords = keywords
 self._loop = loop
 self._runs_per_test = runs_per_test
@@ -2407,10 +2402,6 @@
 result.addSkip(test, 'blacklisted')
 continue
 
-if self._retest and not os.path.exists(test.errpath):
-result.addIgnore(test, 'not retesting')
-continue
-
 if self._keywords:
 with open(test.path, 'rb') as f:
 t = f.read().lower() + test.bname.lower()
@@ -3253,6 +3244,21 @@
 tests.append({'path': t})
 else:
 tests.append({'path': t})
+
+if self.options.retest:
+retest_args = []
+for test in tests:
+if 'case' in test:
+casestr = b'#'.join(test['case'])
+errpath = b'%s#%s.err' % (test['path'], casestr)
+else:
+errpath = b'%s.err' % test['path']
+if self.options.outputdir:
+errpath = os.path.join(self.options.outputdir, errpath)
+
+if os.path.exists(errpath):
+retest_args.append(test)
+tests = retest_args
 return tests
 
 def _runtests(self, testdescs):
@@ -3298,7 +3304,6 @@
 jobs=jobs,
 whitelist=self.options.whitelisted,
 blacklist=self.options.blacklist,
-retest=self.options.retest,
 keywords=kws,
 loop=self.options.loop,
 runs_per_test=self.options.runs_per_test,



To: khanchi97, #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


D8353: debugcommands: create new debugantivirusrunning command

2020-06-29 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In D8353#129493 , @pulkit wrote:
  
  > In D8353#128839 , @marmoute 
wrote:
  >
  >> In D8353#128838 , @durin42 
wrote:
  >>
  >>> Sadly  I have no idea on that.
  >>
  >> Do we have a poor windows user that could serve an a guinea pig here ?
  >
  > Seems like we are not able to find a guinea pig here. How about pushing the 
patch and finding one in wild? :D
  
  Sounds good to me.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8353/new/

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

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


D8646: update: suggest --merge while `hg up` across topo branches

2020-06-21 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Before this patch, during `hg up` across topological branches with
  dirty working directory we suggested the user to "commit or update
  --clean to discard"
  
  I think suggesting --merge is better than --clean (which discard
  changes with no backup). We can keep all the three options, but
  probably then we will have sacrifice length of message.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/merge.py
  tests/test-merge5.t
  tests/test-update-branches.t

CHANGE DETAILS

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -129,19 +129,19 @@
 
   $ revtest 'none dirty same'   dirty 2 3
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   parent=2
   M foo
 
   $ revtest 'none dirtysub same'   dirtysub 2 3
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   parent=2
   M sub/suba
 
   $ revtest 'none dirty cross'  dirty 3 4
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   parent=3
   M foo
 
@@ -154,7 +154,7 @@
 
   $ revtest 'none dirtysub cross'  dirtysub 3 4
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   parent=3
   M sub/suba
 
@@ -368,7 +368,7 @@
 
   $ revtest 'dirty cross'  dirty 3 4
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   parent=3
   M foo
 
@@ -572,7 +572,7 @@
   $ echo conflict > a
   $ hg up --hidden 3
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   [255]
 
 Test that we still warn also when there are conflicts
@@ -673,7 +673,7 @@
   $ hg up --quiet 2
   $ hg up 5
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   [255]
 
 Test that we don't crash when updating from a pruned changeset (i.e. has no
diff --git a/tests/test-merge5.t b/tests/test-merge5.t
--- a/tests/test-merge5.t
+++ b/tests/test-merge5.t
@@ -26,7 +26,7 @@
 
   $ hg update 1
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   [255]
   $ mv c a
 
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1644,7 +1644,7 @@
 pass  # allow updating to successors
 else:
 msg = _(b"uncommitted changes")
-hint = _(b"commit or update --clean to discard 
changes")
+hint = _(b"commit or update --merge to take along 
changes")
 raise error.UpdateAbort(msg, hint=hint)
 else:
 # Allow jumping branches if clean and specific rev given



To: khanchi97, #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


D8643: absorb: make it clear what happens when no input

2020-06-20 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/absorb.py
  tests/test-absorb.t

CHANGE DETAILS

diff --git a/tests/test-absorb.t b/tests/test-absorb.t
--- a/tests/test-absorb.t
+++ b/tests/test-absorb.t
@@ -97,7 +97,7 @@
   84e5416 commit 5
   ff5d556 commit 3
   f548282 commit 1
-  apply changes (yn)?  y
+  apply changes (y/N)?  y
   saved backup bundle to * (glob)
   3 of 3 chunk(s) applied
   $ hg annotate a
diff --git a/hgext/absorb.py b/hgext/absorb.py
--- a/hgext/absorb.py
+++ b/hgext/absorb.py
@@ -1045,7 +1045,7 @@
 not opts.get(b'apply_changes')
 and state.ctxaffected
 and ui.promptchoice(
-b"apply changes (yn)? $$  $$ ", default=1
+b"apply changes (y/N)? $$  $$ ", default=1
 )
 ):
 raise error.Abort(_(b'absorb cancelled\n'))



To: khanchi97, #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


D8621: phabricator: make it clear what happen when no response

2020-06-09 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added subscribers: mercurial-patches, Kwan.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/phabricator.py
  tests/test-phabricator.t

CHANGE DETAILS

diff --git a/tests/test-phabricator.t b/tests/test-phabricator.t
--- a/tests/test-phabricator.t
+++ b/tests/test-phabricator.t
@@ -670,7 +670,7 @@
   NEW - a959a3f69d8d: one: first commit to review
   NEW - 24a4438154ba: two: second commit to review
   NEW - d235829e802c: 3: a commit with no detailed message
-  Send the above changes to https://phab.mercurial-scm.org/ (yn)? y
+  Send the above changes to https://phab.mercurial-scm.org/ (Y/n)? y
   D8387 - created - a959a3f69d8d: one: first commit to review
   D8387 - created - 24a4438154ba: two: second commit to review
   D8387 - created - d235829e802c: 3: a commit with no detailed message
@@ -734,7 +734,7 @@
   D8387 - 602c4e738243: one: first commit to review
   D8387 - 0124e5474c88: two: second commit to review
   D8387 - e4edb1fe3565: 3: a commit with no detailed message
-  Send the above changes to https://phab.mercurial-scm.org/ (yn)? y
+  Send the above changes to https://phab.mercurial-scm.org/ (Y/n)? y
   D8387 - updated - 602c4e738243: one: first commit to review
   D8387 - updated - 0124e5474c88: two: second commit to review
   D8387 - updated - e4edb1fe3565: 3: a commit with no detailed message
diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -1650,7 +1650,7 @@
 )
 
 if ui.promptchoice(
-_(b'Send the above changes to %s (yn)?$$  $$ ') % url
+_(b'Send the above changes to %s (Y/n)?$$  $$ ') % url
 ):
 return False
 



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


D8620: tests: make it clear what happen when no response entered

2020-06-08 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/run-tests.py
  tests/test-run-tests.t

CHANGE DETAILS

diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -747,7 +747,7 @@
This is a noop statement so that
this test is still more bytes than success.
pad pad pad pad
-  Accept this change? [n] 
+  Accept this change? [yN] 
   ERROR: test-failure.t output changed
   !.
   Failed test-failure.t: output changed
@@ -772,7 +772,7 @@
   $ echo 'n' | rt -i --view echo
   running 2 tests using 1 parallel processes 
   $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
-  Accept this change? [n]* (glob)
+  Accept this change? [yN]* (glob)
   ERROR: test-failure.t output changed
   !.
   Failed test-failure.t: output changed
@@ -823,7 +823,7 @@
   +  saved backup bundle to $TESTTMP/foo.hg
  $ echo 'saved backup bundle to $TESTTMP/foo.hg'
  saved backup bundle to $TESTTMP/*.hg (glob)
-  Accept this change? [n] ..
+  Accept this change? [yN] ..
   # Ran 2 tests, 0 skipped, 0 failed.
 
   $ sed -e 's,(glob)$,&<,g' test-failure.t
@@ -900,7 +900,7 @@
#endif
#if b
  $ echo 2
-  Accept this change? [n] .
+  Accept this change? [yN] .
   --- $TESTTMP/test-cases.t
   +++ $TESTTMP/test-cases.t#b.err
   @@ -5,4 +5,5 @@
@@ -909,7 +909,7 @@
  $ echo 2
   +  2
#endif
-  Accept this change? [n] .
+  Accept this change? [yN] .
   # Ran 2 tests, 0 skipped, 0 failed.
 
   $ cat test-cases.t
@@ -1285,7 +1285,7 @@
This is a noop statement so that
this test is still more bytes than success.
pad pad pad pad
-  Accept this change? [n] ..s
+  Accept this change? [yN] ..s
   Skipped test-skip.t: missing feature: nail clipper
   # Ran 2 tests, 1 skipped, 0 failed.
 
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2260,7 +2260,7 @@
 'changes)'
 )
 else:
-self.stream.write('Accept this change? [n] ')
+self.stream.write('Accept this change? [yN] ')
 self.stream.flush()
 answer = sys.stdin.readline().strip()
 if answer.lower() in ('y', 'yes'):



To: khanchi97, #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


D6735: update: added support for --abort flag(issue4404)

2020-03-16 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In D6735#100642 , @mharbison72 
wrote:
  
  > Here's a case I stumbled upon that is a problem.  It looks like it thinks 
it isn't in the middle of an update, but .hgsubstate isn't put back to the 
pre-update state.
  >
  >   diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
  >   --- a/tests/test-subrepo.t
  >   +++ b/tests/test-subrepo.t
  >   @@ -1027,10 +1027,38 @@ filesystem (see also issue4583))
  >  > [extensions]
  >  > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
  >  > EOF
  >   +  $ hg -R repo st -S
  >   +  ? s/b
  >   +  $ hg -R repo diff -S
  >   +  $ hg -R repo log -r .
  >   +  changeset:   0:c4018e9aea1b
  >   +  user:test
  >   +  date:Thu Jan 01 00:00:00 1970 +
  >   +  summary: 1
  >   +
  >   +  $ cat repo/.hgsubstate
  >   +  f7b1eb17ad24730a1651fccd46c43826d1bbc2ac s
  >  $ hg -R repo update
  >  b: untracked file differs
  >  abort: untracked files in working directory differ from files in 
requested revision (in subrepository "s")
  
  @mharbison72 I am bit confused here.
  
  1. Since `hg -R repo update` resulted with an abort then why we have dirty 
working directory now? Isn't transaction rollback worked correctly?
  2. Also if you run `hg status` it says "To continue: run `hg update .`" but I 
don't think it's really a "continue", since we are still on the same changeset 
where we ran the first update command and running `hg update .` won't take us 
to the changeset we wanted to go.
  3. I found that for interrupted update (only for some particular kind of 
interrupted update) we store target node value in `.hg/updatestate` but I 
couldn't find where we exactly use that value. I found some code which check if 
that file exists but not one where we use the value stored in that file.
  
  >   [255]
  >
  > +  $ hg -R repo update --abort
  > +  abort: no update in progress
  > +  [255]
  > +  $ hg -R repo diff -S
  > +  diff -r c4018e9aea1b .hgsubstate
  > +  --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +
  > +  +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +
  > +  @@ -1,1 +1,1 @@
  > +  -f7b1eb17ad24730a1651fccd46c43826d1bbc2ac s
  > +  +cc505f09a8b2644adffa368adb4abc6f70d07bc0 s
  > +  $ hg -R repo log -r .
  > +  changeset:   0:c4018e9aea1b
  > +  user:test
  > +  date:Thu Jan 01 00:00:00 1970 +
  > +  summary: 1
  > +
  > +
  >
  >   $ cat >> repo/.hg/hgrc <   > [extensions]
  >   > fakedirstatewritetime = !
  >
  >   Another good way to induce this .hgsubstate issue is to `hg pull -u` on a 
repo, where the remote subrepo isn't available.  You don't need http for this- 
you can just rename the remote subrepo.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6735/new/

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

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


D7730: rebase: make sure pruning does not confuse rebase (issue6180)

2020-02-01 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 19816.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7730?vs=19283=19816

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7730/new/

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

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-conflicts.t

CHANGE DETAILS

diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -481,14 +481,13 @@
   $ hg resolve -m
   (no more unresolved files)
   continue: hg rebase --continue
-XXX: it should have rebased revision 3 since it made changes unrelated to
-destination, so no reason to say "its destination already has all its changes"
   $ hg rebase -c
   note: not rebasing 2:06a50ac6b5ab "conflict in a", it has no successor
   rebasing 3:aea370672fd7 "add b" (tip)
-  note: not rebasing 3:aea370672fd7 "add b" (tip), its destination already has 
all its changes
   $ hg tglog
-  @  1:draft 'edit a'
+  @  4:draft 'add b'
+  |
+  o  1:draft 'edit a'
   |
   o  0:draft 'add a'
   
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -594,6 +594,10 @@
 adjustdest(repo, rev, self.destmap, self.state, self.skipped)
 )
 self.state[rev] = dest
+# since we are done, make sure wdir has one parent (issue6180)
+if len(self.wctx.parents()) == 2:
+p1 = self.wctx.p1().node()
+self.wctx.setparents(p1)
 elif self.state[rev] == revtodo:
 ui.status(_(b'rebasing %s\n') % desc)
 progressfn(ctx)



To: khanchi97, martinvonz, #hg-reviewers
Cc: marmoute, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7728: rebase: add test to demonstrate issue6180

2020-02-01 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 19815.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7728?vs=19282=19815

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7728/new/

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

AFFECTED FILES
  tests/test-rebase-conflicts.t

CHANGE DETAILS

diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -429,3 +429,66 @@
   |/
   o  0:draft 'A'
   
+Test to make sure that pruning while rebasing doesn't confuse rebase 
(issue6180)
+  $ cat >> $HGRCPATH < [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
+  > [rebase]
+  > experimental.inmemory=1
+  > EOF
+
+The test case below starts a rebase of 2 commits and runs into conflicts on
+the first one. We then decide we don't want the changes from that commit, so
+we revert the changes and also prune the original commit.
+Now what we expect from `hg rebase --continue` is that it skip rebasing first
+one (since it's pruned) but don't skip second one.
+
+  $ hg init issue6180
+  $ cd issue6180
+  $ echo 0 > a
+  $ hg ci -Aqm 'add a'
+  $ echo 1 > a
+  $ hg ci -m 'edit a'
+  $ hg co -q 0
+  $ echo 2 > a
+  $ hg ci -qm 'conflict in a'
+  $ echo 3 > b
+  $ hg ci -Aqm 'add b'
+  $ hg tglog
+  @  3:draft 'add b'
+  |
+  o  2:draft 'conflict in a'
+  |
+  | o  1:draft 'edit a'
+  |/
+  o  0:draft 'add a'
+  
+  $ hg rebase -d 1
+  rebasing 2:06a50ac6b5ab "conflict in a"
+  merging a
+  hit merge conflicts; re-running rebase without in-memory merge
+  rebasing 2:06a50ac6b5ab "conflict in a"
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+  $ echo 1 > a
+  $ hg debugobsolete $(hg id -ir 2 --debug)
+  1 new obsolescence markers
+  obsoleted 1 changesets
+  1 new orphan changesets
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg rebase --continue
+XXX: it should have rebased revision 3 since it made changes unrelated to
+destination, so no reason to say "its destination already has all its changes"
+  $ hg rebase -c
+  note: not rebasing 2:06a50ac6b5ab "conflict in a", it has no successor
+  rebasing 3:aea370672fd7 "add b" (tip)
+  note: not rebasing 3:aea370672fd7 "add b" (tip), its destination already has 
all its changes
+  $ hg tglog
+  @  1:draft 'edit a'
+  |
+  o  0:draft 'add a'
+  



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


D7730: rebase: make sure pruning does not confuse rebase (issue6180)

2020-01-15 Thread khanchi97 (Sushil khanchi)
khanchi97 added inline comments.

INLINE COMMENTS

> martinvonz wrote in rebase.py:597
> I think it's incorrect that rebase sets two parents while the merge is being 
> resolved, but that's out of scope for this patch.

I will look into it.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7730/new/

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

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


D7730: rebase: make sure pruning does not confuse rebase (issue6180)

2020-01-15 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In D7730#114953 , @pulkit wrote:
  
  > Unrelated to the fix, we need better way to skip commits during rebasing. 
Pruning manually is not a good option, IIRC git rebase have a `--skip` flag.
  
  Yeah, that's a good idea. We should also have --skip flag to skip the commit 
on which rebase got interrupted.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7730/new/

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

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


D7730: rebase: make sure pruning does not confuse rebase (issue6180)

2020-01-15 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 19283.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7730?vs=18939=19283

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7730/new/

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

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-conflicts.t

CHANGE DETAILS

diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -476,14 +476,13 @@
   $ hg resolve -m
   (no more unresolved files)
   continue: hg rebase --continue
-XXX: it should have rebased revision 3 since it made changes unrelated to
-destination, so no reason to say "its destination already has all its changes"
   $ hg rebase -c
   note: not rebasing 2:06a50ac6b5ab "conflict in a", it has no successor
   rebasing 3:aea370672fd7 "add b" (tip)
-  note: not rebasing 3:aea370672fd7 "add b" (tip), its destination already has 
all its changes
   $ hg tglog
-  @  1:draft 'edit a'
+  @  4:draft 'add b'
+  |
+  o  1:draft 'edit a'
   |
   o  0:draft 'add a'
   
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -594,6 +594,10 @@
 adjustdest(repo, rev, self.destmap, self.state, self.skipped)
 )
 self.state[rev] = dest
+# since we are done, make sure wdir has one parent (issue6180)
+if len(self.wctx.parents()) == 2:
+p1 = self.wctx.p1().node()
+repo.setparents(p1)
 elif self.state[rev] == revtodo:
 ui.status(_(b'rebasing %s\n') % desc)
 progressfn(ctx)



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


D7728: rebase: add test to demonstrate issue6180

2020-01-15 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 19282.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7728?vs=18937=19282

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7728/new/

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

AFFECTED FILES
  tests/test-rebase-conflicts.t

CHANGE DETAILS

diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -429,3 +429,61 @@
   |/
   o  0:draft 'A'
   
+Test to make sure that pruning while rebasing doesn't confuse rebase 
(issue6180)
+  $ cat >> $HGRCPATH < [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
+  > EOF
+
+The test case below starts a rebase of 2 commits and runs into conflicts on
+the first one. We then decide we don't want the changes from that commit, so
+we revert the changes and also prune the original commit.
+Now what we expect from `hg rebase --continue` is that it skip rebasing first
+one (since it's pruned) but don't skip second one.
+
+  $ hg init issue6180
+  $ cd issue6180
+  $ echo 0 > a
+  $ hg ci -Aqm 'add a'
+  $ echo 1 > a
+  $ hg ci -m 'edit a'
+  $ hg co -q 0
+  $ echo 2 > a
+  $ hg ci -qm 'conflict in a'
+  $ echo 3 > b
+  $ hg ci -Aqm 'add b'
+  $ hg tglog
+  @  3:draft 'add b'
+  |
+  o  2:draft 'conflict in a'
+  |
+  | o  1:draft 'edit a'
+  |/
+  o  0:draft 'add a'
+  
+  $ hg rebase -d 1
+  rebasing 2:06a50ac6b5ab "conflict in a"
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+  $ echo 1 > a
+  $ hg debugobsolete $(hg id -ir 2 --debug)
+  1 new obsolescence markers
+  obsoleted 1 changesets
+  1 new orphan changesets
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg rebase --continue
+XXX: it should have rebased revision 3 since it made changes unrelated to
+destination, so no reason to say "its destination already has all its changes"
+  $ hg rebase -c
+  note: not rebasing 2:06a50ac6b5ab "conflict in a", it has no successor
+  rebasing 3:aea370672fd7 "add b" (tip)
+  note: not rebasing 3:aea370672fd7 "add b" (tip), its destination already has 
all its changes
+  $ hg tglog
+  @  1:draft 'edit a'
+  |
+  o  0:draft 'add a'
+  



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


D7730: rebase: make sure pruning does not confuse rebase (issue6180)

2020-01-08 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  Ping.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7730/new/

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

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


D7728: rebase: add test to demonstrate issue6180

2020-01-08 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  Ping.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7728/new/

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

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


D7786: update: add --abort option in hg update command (issue4404)

2020-01-03 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Here is, what --abort option is basically doing:
  
  1. hg resolve --unmark, then
  2. hg resolve --all --tool :local
  3. hg up  --tool :local
  
  Where,
  step 1) is to mark all the files conflicted as unresolved (marking *all*
  files to make sure that it also mark the files which might have been
  resolved by user in meantime)
  
  step 2) resolve all the conflicting files using `--tool :local`
  
  step 3) update to the revision where it was checkedout before running the
  hg update, using `--tool :local`
  
  Use of `--tool :local` while updating to old revision (step3) make sure that
  it will not hit merge conflict at the time of update. And since we are using
  the same tool (:local) as we used at the time of resolution (step2) it makes
  sure that we have exact changes in working directory as it was before IIUC.
  
  Added tests demonstrate the behaviour of new flag.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-completion.t
  tests/test-update-branches.t

CHANGE DETAILS

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -676,3 +676,80 @@
   [255]
   $ hg co --no-check 2
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd ..
+
+Test hg update --abort option
+  $ hg init issue4404
+  $ cd issue4404
+  $ echo "before\nmiddle" > file
+  $ hg add file
+  $ hg commit -mbefore
+  $ echo "after\nmiddle" > file
+  $ hg commit -mafter
+  $ echo "edited\nmiddle\nlast" > file
+  $ echo foo > foo
+  $ hg add foo
+
+  $ hg diff
+  diff -r fd93e7c2e3ea file
+  --- a/file   Thu Jan 01 00:00:00 1970 +
+  +++ b/file   Thu Jan 01 00:00:00 1970 +
+  @@ -1,2 +1,3 @@
+  -after
+  +edited
+   middle
+  +last
+  diff -r fd93e7c2e3ea foo
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/fooThu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +foo
+
+  $ hg update 0 --no-check
+  merging file
+  warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+  [1]
+  $ hg diff
+  diff -r f013c8cc5b24 file
+  --- a/file   Thu Jan 01 00:00:00 1970 +
+  +++ b/file   Thu Jan 01 00:00:00 1970 +
+  @@ -1,2 +1,7 @@
+  +<<< working copy: fd93e7c2e3ea - test: after
+  +edited
+  +===
+   before
+  +>>> destination:  f013c8cc5b24 - test: before
+   middle
+  +last
+  diff -r f013c8cc5b24 foo
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/fooThu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +foo
+
+  $ hg up --abort
+  update aborted
+
+Make sure diff is same as it was before running hg update
+  $ hg diff
+  diff -r fd93e7c2e3ea file
+  --- a/file   Thu Jan 01 00:00:00 1970 +
+  +++ b/file   Thu Jan 01 00:00:00 1970 +
+  @@ -1,2 +1,3 @@
+  -after
+  +edited
+   middle
+  +last
+  diff -r fd93e7c2e3ea foo
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/fooThu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +foo
+
+Error out if there is no interrupted update
+  $ hg up --abort
+  abort: no interrupted update exists
+  [255]
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -357,7 +357,7 @@
   tip: patch, git, style, template
   unbundle: update
   unshelve: abort, continue, interactive, keep, name, tool, date
-  update: clean, check, merge, date, rev, tool
+  update: abort, clean, check, merge, date, rev, tool
   verify: full
   version: template
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -7590,6 +7590,7 @@
 @command(
 b'update|up|checkout|co',
 [
+(b'a', b'abort', None, _(b'abort the interrupted update')),
 (b'C', b'clean', None, _(b'discard uncommitted changes (no backup)')),
 (b'c', b'check', None, _(b'require clean working directory')),
 (b'm', b'merge', None, _(b'merge uncommitted changes')),
@@ -7661,9 +7662,26 @@
 clean = opts.get('clean')
 check = opts.get('check')
 merge = opts.get('merge')
+abort = opts.get('abort')
 if rev and node:
 raise error.Abort(_(b"please specify just one revision"))
 
+if abort:
+overrides = {(b'ui', b'forcemerge'): b':local', (b'ui', 'quiet'): True}
+with repo.wlock(), ui.configoverride(overrides, b'update'):
+ms = mergemod.mergestate.read(repo)
+if not ms.active():
+raise error.Abort(_(b'no interrupted update exists'))
+resolve(ui, repo, **{'unmark': True})
+resolve(ui, repo, **{'all': True, 

D7730: rebase: make sure pruning does not confuse rebase (issue6180)

2019-12-27 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this patch, if a user is rebasing a stack of commits and
  hit a conflict in between and decided to drop that commit (the commit
  which is being rebased but hit conflict) and pruned it, now what
  `hg rebase --continue` does is: skip that dropped commit and move
  on to rebase the next commit and gets confused here because wdir
  has two parents which is because while we skipped that dropped
  commit wdir had two parents and we didn't update that to one parent.
  
  Changes in test file demonstrate the fixed behavior.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-conflicts.t

CHANGE DETAILS

diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -478,14 +478,13 @@
   $ hg resolve -m
   (no more unresolved files)
   continue: hg rebase --continue
-XXX: it should have rebased revision 3 since it made changes unrelated to
-destination, so no reason to say "its destination already has all its changes"
   $ hg rebase -c
   note: not rebasing 2:06a50ac6b5ab "conflict in a", it has no successor
   rebasing 3:aea370672fd7 "add b" (tip)
-  note: not rebasing 3:aea370672fd7 "add b" (tip), its destination already has 
all its changes
   $ hg tglog
-  @  1:draft 'edit a'
+  @  4:draft 'add b'
+  |
+  o  1:draft 'edit a'
   |
   o  0:draft 'add a'
   
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -594,6 +594,10 @@
 adjustdest(repo, rev, self.destmap, self.state, self.skipped)
 )
 self.state[rev] = dest
+# since we are done, make sure wdir has one parent (issue6180)
+if len(repo[None].parents()) == 2:
+p1 = repo[None].p1().node()
+repo.setparents(p1)
 elif self.state[rev] == revtodo:
 ui.status(_(b'rebasing %s\n') % desc)
 progressfn(ctx)



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


D7727: rebase: make sure pruning does not confuse rebase (issue6180)

2019-12-27 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.
khanchi97 abandoned this revision.


  abandoing because I phabsent them in reverse order and it got messed up 
saying 'Graph cycle detected'

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7727/new/

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

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


D7728: rebase: add test to demonstrate issue6180

2019-12-27 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It will be fixed in next patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-rebase-conflicts.t

CHANGE DETAILS

diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -429,3 +429,63 @@
   |/
   o  0:draft 'A'
   
+Test to make sure that pruning while rebasing doesn't confuse rebase 
(issue6180)
+  $ cat >> $HGRCPATH < [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
+  > [alias]
+  > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
+  > EOF
+
+The test case below starts a rebase of 2 commits and runs into conflicts on
+the first one. We then decide we don't want the changes from that commit, so
+we revert the changes and also prune the original commit.
+Now what we expect from `hg rebase --continue` is that it skip rebasing first
+one (since it's pruned) but don't skip second one.
+
+  $ hg init issue6180
+  $ cd issue6180
+  $ echo 0 > a
+  $ hg ci -Aqm 'add a'
+  $ echo 1 > a
+  $ hg ci -m 'edit a'
+  $ hg co -q 0
+  $ echo 2 > a
+  $ hg ci -qm 'conflict in a'
+  $ echo 3 > b
+  $ hg ci -Aqm 'add b'
+  $ hg tglog
+  @  3:draft 'add b'
+  |
+  o  2:draft 'conflict in a'
+  |
+  | o  1:draft 'edit a'
+  |/
+  o  0:draft 'add a'
+  
+  $ hg rebase -d 1
+  rebasing 2:06a50ac6b5ab "conflict in a"
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+  $ echo 1 > a
+  $ hg debugobsolete $(hg id -ir 2 --debug)
+  1 new obsolescence markers
+  obsoleted 1 changesets
+  1 new orphan changesets
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg rebase --continue
+XXX: it should have rebased revision 3 since it made changes unrelated to
+destination, so no reason to say "its destination already has all its changes"
+  $ hg rebase -c
+  note: not rebasing 2:06a50ac6b5ab "conflict in a", it has no successor
+  rebasing 3:aea370672fd7 "add b" (tip)
+  note: not rebasing 3:aea370672fd7 "add b" (tip), its destination already has 
all its changes
+  $ hg tglog
+  @  1:draft 'edit a'
+  |
+  o  0:draft 'add a'
+  



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


D7727: rebase: make sure pruning does not confuse rebase (issue6180)

2019-12-27 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this patch, if a user is rebasing a stack of commits and
  hit a conflict in between and decided to drop that commit (the commit
  which is being rebased but hit conflict) and pruned it, now what
  `hg rebase --continue` does is: skip that dropped commit and move
  on to rebase the next commit and gets confused here because wdir
  has two parents which is because while we skipped that dropped
  commit wdir had two parents and we didn't update that to one parent.
  
  Changes in test file demonstrate the fixed behavior.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-conflicts.t

CHANGE DETAILS

diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -478,14 +478,13 @@
   $ hg resolve -m
   (no more unresolved files)
   continue: hg rebase --continue
-XXX: it should have rebased revision 3 since it made changes unrelated to
-destination, so no reason to say "its destination already has all its changes"
   $ hg rebase -c
   note: not rebasing 2:06a50ac6b5ab "conflict in a", it has no successor
   rebasing 3:aea370672fd7 "add b" (tip)
-  note: not rebasing 3:aea370672fd7 "add b" (tip), its destination already has 
all its changes
   $ hg tglog
-  @  1:draft 'edit a'
+  @  4:draft 'add b'
+  |
+  o  1:draft 'edit a'
   |
   o  0:draft 'add a'
   
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -594,6 +594,10 @@
 adjustdest(repo, rev, self.destmap, self.state, self.skipped)
 )
 self.state[rev] = dest
+# since we are done, make sure wdir has one parent (issue6180)
+if len(repo[None].parents()) == 2:
+p1 = repo[None].p1().node()
+repo.setparents(p1)
 elif self.state[rev] == revtodo:
 ui.status(_(b'rebasing %s\n') % desc)
 progressfn(ctx)



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


D7000: grep: enable all-files by default (BC)

2019-10-21 Thread khanchi97 (Sushil khanchi)
Closed by commit rHG8cb5f96db235: grep: enable all-files by default (BC) 
(authored by khanchi97).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D7000?vs=16909=17364#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7000?vs=16909=17364

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7000/new/

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-grep.t

CHANGE DETAILS

diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -27,10 +27,30 @@
   port:4:export
   port:4:vaportight
   port:4:import/export
+  port:3:export
+  port:3:vaportight
+  port:3:import/export
+  port:3:import/export
+  port:2:export
+  port:2:vaportight
+  port:2:import/export
+  port:1:import
+  port:1:export
+  port:0:import
   $ hg grep -r tip:0 port port
   port:4:export
   port:4:vaportight
   port:4:import/export
+  port:3:export
+  port:3:vaportight
+  port:3:import/export
+  port:3:import/export
+  port:2:export
+  port:2:vaportight
+  port:2:import/export
+  port:1:import
+  port:1:export
+  port:0:import
 
 simple from subdirectory
 
@@ -40,10 +60,30 @@
   port:4:export
   port:4:vaportight
   port:4:import/export
+  port:3:export
+  port:3:vaportight
+  port:3:import/export
+  port:3:import/export
+  port:2:export
+  port:2:vaportight
+  port:2:import/export
+  port:1:import
+  port:1:export
+  port:0:import
   $ hg grep -r tip:0 port --config ui.relative-paths=yes
   ../port:4:export
   ../port:4:vaportight
   ../port:4:import/export
+  ../port:3:export
+  ../port:3:vaportight
+  ../port:3:import/export
+  ../port:3:import/export
+  ../port:2:export
+  ../port:2:vaportight
+  ../port:2:import/export
+  ../port:1:import
+  ../port:1:export
+  ../port:0:import
   $ cd ..
 
 simple with color
@@ -53,6 +93,16 @@
   
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m
 (esc)
   
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might
 (esc)
   
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m0\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m
 (esc)
 
 simple templated
 
@@ -61,16 +111,46 @@
   port:4:914fa752cdea:exPORT
   port:4:914fa752cdea:vaPORTight
   port:4:914fa752cdea:imPORT/exPORT
+  port:3:95040cfd017d:exPORT
+  port:3:95040cfd017d:vaPORTight
+  port:3:95040cfd017d:imPORT/exPORT
+  port:3:95040cfd017d:imPORT/exPORT
+  port:2:3b325e3481a1:exPORT
+  port:2:3b325e3481a1:vaPORTight
+  port:2:3b325e3481a1:imPORT/exPORT
+  port:1:8b20f75c1585:imPORT
+  port:1:8b20f75c1585:exPORT
+  port:0:f31323c92170:imPORT
 
   $ hg grep port -r tip:0 -T '{path}:{rev}:{texts}\n'
   port:4:export
   port:4:vaportight
   port:4:import/export
+  port:3:export
+  port:3:vaportight
+  port:3:import/export
+  port:3:import/export
+  port:2:export
+  port:2:vaportight
+  port:2:import/export
+  port:1:import
+  port:1:export
+  port:0:import
 
   $ hg grep port -r tip:0 -T '{path}:{tags}:{texts}\n'
   port:tip:export
   port:tip:vaportight
   port:tip:import/export
+  port::export
+  port::vaportight
+  port::import/export
+  port::import/export
+  port::export
+  port::vaportight
+  port::import/export
+  port::import
+  port::export
+  port::import
 
 simple JSON (no "change" field)
 
@@ -102,6 +182,96 @@
 "rev": 4,
 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": 
"port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
 "user": "spam"
+   },
+   {
+"date": 

D7000: grep: enable all-files by default (BC)

2019-10-08 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  Sure :)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7000/new/

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

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


D7000: grep: enable all-files by default (BC)

2019-10-06 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch deprecates the `--all-files` flag and make the all-files
  behaviour as default.
  
  In test-grep.t, I removed '--all-files' from every command where it was
  used, to reflect that all-files behaviour is default and there is no
  change even after the removal.
  And other changes in test files are because of changed behaviour.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-grep.t

CHANGE DETAILS

diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -27,10 +27,30 @@
   port:4:export
   port:4:vaportight
   port:4:import/export
+  port:3:export
+  port:3:vaportight
+  port:3:import/export
+  port:3:import/export
+  port:2:export
+  port:2:vaportight
+  port:2:import/export
+  port:1:import
+  port:1:export
+  port:0:import
   $ hg grep -r tip:0 port port
   port:4:export
   port:4:vaportight
   port:4:import/export
+  port:3:export
+  port:3:vaportight
+  port:3:import/export
+  port:3:import/export
+  port:2:export
+  port:2:vaportight
+  port:2:import/export
+  port:1:import
+  port:1:export
+  port:0:import
 
 simple from subdirectory
 
@@ -40,10 +60,30 @@
   port:4:export
   port:4:vaportight
   port:4:import/export
+  port:3:export
+  port:3:vaportight
+  port:3:import/export
+  port:3:import/export
+  port:2:export
+  port:2:vaportight
+  port:2:import/export
+  port:1:import
+  port:1:export
+  port:0:import
   $ hg grep -r tip:0 port --config ui.relative-paths=yes
   ../port:4:export
   ../port:4:vaportight
   ../port:4:import/export
+  ../port:3:export
+  ../port:3:vaportight
+  ../port:3:import/export
+  ../port:3:import/export
+  ../port:2:export
+  ../port:2:vaportight
+  ../port:2:import/export
+  ../port:1:import
+  ../port:1:export
+  ../port:0:import
   $ cd ..
 
 simple with color
@@ -53,6 +93,16 @@
   
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m
 (esc)
   
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might
 (esc)
   
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m
 (esc)
+  
\x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m0\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m
 (esc)
 
 simple templated
 
@@ -61,16 +111,46 @@
   port:4:914fa752cdea:exPORT
   port:4:914fa752cdea:vaPORTight
   port:4:914fa752cdea:imPORT/exPORT
+  port:3:95040cfd017d:exPORT
+  port:3:95040cfd017d:vaPORTight
+  port:3:95040cfd017d:imPORT/exPORT
+  port:3:95040cfd017d:imPORT/exPORT
+  port:2:3b325e3481a1:exPORT
+  port:2:3b325e3481a1:vaPORTight
+  port:2:3b325e3481a1:imPORT/exPORT
+  port:1:8b20f75c1585:imPORT
+  port:1:8b20f75c1585:exPORT
+  port:0:f31323c92170:imPORT
 
   $ hg grep port -r tip:0 -T '{path}:{rev}:{texts}\n'
   port:4:export
   port:4:vaportight
   port:4:import/export
+  port:3:export
+  port:3:vaportight
+  port:3:import/export
+  port:3:import/export
+  port:2:export
+  port:2:vaportight
+  port:2:import/export
+  port:1:import
+  port:1:export
+  port:0:import
 
   $ hg grep port -r tip:0 -T '{path}:{tags}:{texts}\n'
   port:tip:export
   port:tip:vaportight
   port:tip:import/export
+  port::export
+  port::vaportight
+  port::import/export
+  port::import/export
+  port::export
+  port::vaportight
+  port::import/export
+  port::import
+  port::export
+  port::import
 
 simple JSON (no "change" field)
 
@@ -102,6 +182,96 @@
 "rev": 4,
 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": 
"port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
 "user": "spam"
+   },
+   {
+"date": [3, 0],
+

D6590: relnotes: document the new --force-close-branch flag

2019-07-04 Thread khanchi97 (Sushil khanchi)
Closed by commit rHG4cafbd3b50c6: relnotes: document the new 
--force-close-branch flag (authored by khanchi97).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6590?vs=15726=15758

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6590/new/

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

AFFECTED FILES
  relnotes/next

CHANGE DETAILS

diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -6,6 +6,9 @@
  * `hg root` now has templating support, including support for showing
where a repo share's source is. See `hg help -v root` for details.
 
+ * New `--force-close-branch` flag for `hg commit` to forcibly close
+   branch from a non-head changeset.
+
 
 == New Experimental Features ==
 



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


D6590: relnotes: document the new --force-close-branch flag

2019-06-30 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  relnotes/next

CHANGE DETAILS

diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -6,6 +6,9 @@
  * `hg root` now has templating support, including support for showing
where a repo share's source is. See `hg help -v root` for details.
 
+ * New `--force-close-branch` flag for `hg commit` to forcibly close
+   branch from a non-head changeset.
+
 
 == New Experimental Features ==
 



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


D6490: commit: add --force-close-branch flag to close a non-head changeset

2019-06-23 Thread khanchi97 (Sushil khanchi)
khanchi97 edited the summary of this revision.
khanchi97 retitled this revision from "commit: add --force flag to close branch 
from a non-head changeset" to "commit: add --force-close-branch flag to close a 
non-head changeset".
khanchi97 updated this revision to Diff 15633.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6490?vs=15531=15633

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6490/new/

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-branches.t
  tests/test-completion.t

CHANGE DETAILS

diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -245,7 +245,7 @@
   bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
   cat: output, rev, decode, include, exclude, template
   clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, 
remotecmd, insecure
-  commit: addremove, close-branch, amend, secret, edit, interactive, include, 
exclude, message, logfile, date, user, subrepos
+  commit: addremove, close-branch, amend, secret, edit, force-close-branch, 
interactive, include, exclude, message, logfile, date, user, subrepos
   config: untrusted, edit, local, global, template
   copy: after, force, include, exclude, dry-run
   debugancestor: 
diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -958,6 +958,7 @@
 it should abort:
   $ hg ci -m "closing branch" --close-branch
   abort: can only close branch heads
+  (use --force-close-branch to close branch from a non-head changeset)
   [255]
 
   $ hg up 0
@@ -972,3 +973,18 @@
   @  0: 9092f1db7931 added a
default
   
+Test --force-close-branch to close a branch from a non-head changeset:
+-
+
+  $ hg show stack --config extensions.show=
+o  1553 added c
+o  5f6d added b
+@  9092 added a
+
+  $ hg ci -m "branch closed" --close-branch
+  abort: can only close branch heads
+  (use --force-close-branch to close branch from a non-head changeset)
+  [255]
+
+  $ hg ci -m "branch closed" --force-close-branch
+  created new head
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1583,6 +1583,8 @@
 ('', 'amend', None, _('amend the parent of the working directory')),
 ('s', 'secret', None, _('use the secret phase for committing')),
 ('e', 'edit', None, _('invoke editor on commit messages')),
+('', 'force-close-branch', None,
+ _('forcibly close branch from a non-head changeset (ADVANCED)')),
 ('i', 'interactive', None, _('use interactive mode')),
 ] + walkopts + commitopts + commitopts2 + subrepoopts,
 _('[OPTION]... [FILE]...'),
@@ -1670,7 +1672,7 @@
 bheads = repo.branchheads(branch)
 
 extra = {}
-if opts.get('close_branch'):
+if opts.get('close_branch') or opts.get('force_close_branch'):
 extra['close'] = '1'
 
 if repo['.'].closesbranch():
@@ -1678,8 +1680,11 @@
 ' head'))
 elif not bheads:
 raise error.Abort(_('branch "%s" has no heads to close') % branch)
-elif branch == repo['.'].branch() and repo['.'].node() not in bheads:
-raise error.Abort(_('can only close branch heads'))
+elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
+  and not opts.get('force_close_branch')):
+hint = _('use --force-close-branch to close branch from a non-head'
+ ' changeset')
+raise error.Abort(_('can only close branch heads'), hint=hint)
 elif opts.get('amend'):
 if (repo['.'].p1().branch() != branch and
 repo['.'].p2().branch() != branch):



To: khanchi97, #hg-reviewers, mharbison72
Cc: martinvonz, markand, pulkit, mharbison72, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6490: commit: add --force flag to close branch from a non-head changeset

2019-06-22 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In D6490#95689 , @mharbison72 
wrote:
  
  > In D6490#95686 , @khanchi97 
wrote:
  >
  >> In D6490#95355 , @markand 
wrote:
  >>
  >>> In D6490#95328 , @mharbison72 
wrote:
  >>>
   In D6490#95305 , @pulkit 
wrote:
  
  > I think adding a `--force` flag to `hg commit` is not a nice option. 
force can mean a lot of things and here except in closing the non-head 
changeset, it is no-op. 
  > For example, I am in middle of a rebase, tried to commit, it says 
rebase in progress. I see there is a --force flag, I try to use that to force 
the commit.
  > We can do one of the following:
  >
  > 1. maybe a more specific flag name like `--allow-close-branch` or 
something like that
  > 2. a config option instead of a flag name
  
   Fair point.  Specific is better.
   I'd suggest `--force-close-branch` as a standalone flag (i.e. you don't 
need to also use `--close-branch`; it wasn't clear to me if that's what you 
meant).  `--allow-close-branch` and `--close-branch` don't seem different 
enough to remember the difference.
  >>>
  >>> Just my $0.02.
  >>> I think that `hg commit` already has many options that do not even belong 
to committing (such as -A, --close-branch). Let's not add an option that is not 
related to commit. To my opinion closing a branch should be done with `hg 
branch` not commit (unfortunately this was never the case). Anyway if you 
really want to do it with commit, I would suggest that `--close-branch` takes 
an optional argument rather than adding a new option. This makes UX a bit more 
convenient
  >>> e.g.
  >>>
  >>>   hg commit --close-branch --force-close-branch (not that)
  >>>   hg commit --close-branch forced (or force or something like that)
  >>
  >> I think it's a little hard to make user understand (by providing a hint 
like "use `force` arg with `--close-branch`") that you need to provide an 
argument as compared to just providing a standalone flag `--force-close-branch` 
as @mharbison72 suggested. I do agree with you that it would make +1 in the no. 
of flags which don't make sense with `hg commit`. What do you say?
  >
  > What if you mark it `(ADVANCED)` so that it doesn't show in the help 
without a `-v`?  Then the hint informs the user when it might be needed, 
otherwise they don't need to see it all the time.
  
  Nice. So I will update the patch for: adding a standalone option 
`--force-close-branch` (ADVANCED) to close a branch from a non-head changeset. 
Feel free to comments if others still have any opinions on this.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6490/new/

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

To: khanchi97, #hg-reviewers, mharbison72
Cc: martinvonz, markand, pulkit, mharbison72, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6490: commit: add --force flag to close branch from a non-head changeset

2019-06-21 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In D6490#95383 , @martinvonz 
wrote:
  
  > Could you also update relnotes/next (documenting either the new flag or 
config option, whatever this patch ends up doing)?
  
  Sure

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6490/new/

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

To: khanchi97, #hg-reviewers, mharbison72
Cc: martinvonz, markand, pulkit, mharbison72, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6490: commit: add --force flag to close branch from a non-head changeset

2019-06-21 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In D6490#95355 , @markand wrote:
  
  > In D6490#95328 , @mharbison72 
wrote:
  >
  >> In D6490#95305 , @pulkit wrote:
  >>
  >>> I think adding a `--force` flag to `hg commit` is not a nice option. 
force can mean a lot of things and here except in closing the non-head 
changeset, it is no-op. 
  >>> For example, I am in middle of a rebase, tried to commit, it says rebase 
in progress. I see there is a --force flag, I try to use that to force the 
commit.
  >>> We can do one of the following:
  >>>
  >>> 1. maybe a more specific flag name like `--allow-close-branch` or 
something like that
  >>> 2. a config option instead of a flag name
  >>
  >> Fair point.  Specific is better.
  >> I'd suggest `--force-close-branch` as a standalone flag (i.e. you don't 
need to also use `--close-branch`; it wasn't clear to me if that's what you 
meant).  `--allow-close-branch` and `--close-branch` don't seem different 
enough to remember the difference.
  >
  > Just my $0.02.
  > I think that `hg commit` already has many options that do not even belong 
to committing (such as -A, --close-branch). Let's not add an option that is not 
related to commit. To my opinion closing a branch should be done with `hg 
branch` not commit (unfortunately this was never the case). Anyway if you 
really want to do it with commit, I would suggest that `--close-branch` takes 
an optional argument rather than adding a new option. This makes UX a bit more 
convenient
  > e.g.
  >
  >   hg commit --close-branch --force-close-branch (not that)
  >   hg commit --close-branch forced (or force or something like that)
  
  I think it's a little hard to make user understand (by providing a hint like 
"use `force` arg with `--close-branch`") that you need to provide an argument 
as compared to just providing a standalone flag `--force-close-branch` as 
@mharbison72 suggested. I do agree with you that it would make +1 in the no. of 
flags which don't make sense with `hg commit`. What do you say?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6490/new/

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

To: khanchi97, #hg-reviewers, mharbison72
Cc: martinvonz, markand, pulkit, mharbison72, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6493: commit: make the error message more specific while aborting branch closing

2019-06-18 Thread khanchi97 (Sushil khanchi)
Closed by commit rHGabd4783db5a7: commit: make the error message more specific 
while aborting branch closing (authored by khanchi97).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D6493?vs=15533=15568#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6493?vs=15533=15568

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6493/new/

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-commit-amend.t

CHANGE DETAILS

diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -892,7 +892,7 @@
   marked working directory as branch silliness
   $ echo b >> b
   $ hg ci --close-branch -m'open and close'
-  abort: can only close branch heads
+  abort: branch "silliness" has no heads to close
   [255]
 
 Test that amend with --secret creates new secret changeset forcibly
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1677,7 +1677,7 @@
 raise error.Abort(_('current revision is already a branch closing'
 ' head'))
 elif not bheads:
-raise error.Abort(_('can only close branch heads'))
+raise error.Abort(_('branch "%s" has no heads to close') % branch)
 elif branch == repo['.'].branch() and repo['.'].node() not in bheads:
 raise error.Abort(_('can only close branch heads'))
 elif opts.get('amend'):



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


D6491: commit: add a check if it is trying to close an already closed branch head

2019-06-18 Thread khanchi97 (Sushil khanchi)
Closed by commit rHG9f7cb777b654: commit: add a check if it is trying to close 
an already closed branch head (authored by khanchi97).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D6491?vs=15532=15567#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6491?vs=15532=15567

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6491/new/

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-branches.t

CHANGE DETAILS

diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -280,7 +280,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
   $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
-  abort: can only close branch heads
+  abort: current revision is already a branch closing head
   [255]
 
   $ hg log -r tip --debug
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1673,7 +1673,10 @@
 if opts.get('close_branch'):
 extra['close'] = '1'
 
-if not bheads:
+if repo['.'].closesbranch():
+raise error.Abort(_('current revision is already a branch closing'
+' head'))
+elif not bheads:
 raise error.Abort(_('can only close branch heads'))
 elif branch == repo['.'].branch() and repo['.'].node() not in bheads:
 raise error.Abort(_('can only close branch heads'))



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


D6490: commit: add --force flag to close branch from a non-head changeset

2019-06-15 Thread khanchi97 (Sushil khanchi)
khanchi97 retitled this revision from "branch: add --force flag to close branch 
from a not-head changeset" to "commit: add --force flag to close branch from a 
non-head changeset".
khanchi97 updated this revision to Diff 15531.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6490?vs=15380=15531

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6490/new/

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-alias.t
  tests/test-branches.t
  tests/test-completion.t
  tests/test-qrecord.t
  tests/test-record.t

CHANGE DETAILS

diff --git a/tests/test-record.t b/tests/test-record.t
--- a/tests/test-record.t
+++ b/tests/test-record.t
@@ -52,6 +52,7 @@
   --amend   amend the parent of the working directory
-s --secret  use the secret phase for committing
-e --editinvoke editor on commit messages
+   -f --force   forcibly close branch from a non-head changeset
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
-m --message TEXTuse text as commit message
diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t
--- a/tests/test-qrecord.t
+++ b/tests/test-qrecord.t
@@ -69,6 +69,7 @@
   --amend   amend the parent of the working directory
-s --secret  use the secret phase for committing
-e --editinvoke editor on commit messages
+   -f --force   forcibly close branch from a non-head changeset
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
-m --message TEXTuse text as commit message
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -245,7 +245,7 @@
   bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
   cat: output, rev, decode, include, exclude, template
   clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, 
remotecmd, insecure
-  commit: addremove, close-branch, amend, secret, edit, interactive, include, 
exclude, message, logfile, date, user, subrepos
+  commit: addremove, close-branch, amend, secret, edit, force, interactive, 
include, exclude, message, logfile, date, user, subrepos
   config: untrusted, edit, local, global, template
   copy: after, force, include, exclude, dry-run
   debugancestor: 
diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -958,6 +958,7 @@
 it should abort:
   $ hg ci -m "closing branch" --close-branch
   abort: can only close branch heads
+  (use --force to close a non-head changeset)
   [255]
 
   $ hg up 0
@@ -972,3 +973,19 @@
   @  0: 9092f1db7931 added a
default
   
+Check --force to close a branch from a cset which is not a branch head
+
+  $ hg show stack --config extensions.show=
+o  1553 added c
+o  5f6d added b
+@  9092 added a
+
+without --force
+  $ hg ci -m "branch closed" --close-branch
+  abort: can only close branch heads
+  (use --force to close a non-head changeset)
+  [255]
+
+with --force
+  $ hg ci -m "branch closed" --close-branch --force
+  created new head
diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -120,6 +120,7 @@
   --amend   amend the parent of the working directory
-s --secret  use the secret phase for committing
-e --editinvoke editor on commit messages
+   -f --force   forcibly close branch from a non-head changeset
-i --interactive use interactive mode
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1583,6 +1583,7 @@
 ('', 'amend', None, _('amend the parent of the working directory')),
 ('s', 'secret', None, _('use the secret phase for committing')),
 ('e', 'edit', None, _('invoke editor on commit messages')),
+('f', 'force', None, _('forcibly close branch from a non-head changeset')),
 ('i', 'interactive', None, _('use interactive mode')),
 ] + walkopts + commitopts + commitopts2 + subrepoopts,
 _('[OPTION]... [FILE]...'),
@@ -1675,12 +1676,18 @@
 
 if not bheads:
 raise error.Abort(_('can only close branch heads'))
-elif branch == repo['.'].branch() and repo['.'].node() not in bheads:
-raise error.Abort(_('can only close branch heads'))
+elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
+  and not opts.get('force')):
+hint = _("use --force to close a 

D6493: commit: make the error message more specific while aborting branch closing

2019-06-15 Thread khanchi97 (Sushil khanchi)
khanchi97 retitled this revision from "branch: make the error message more 
specific while aborting branch closing" to "commit: make the error message more 
specific while aborting branch closing".
khanchi97 updated this revision to Diff 15533.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6493?vs=15382=15533

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6493/new/

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-commit-amend.t

CHANGE DETAILS

diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -892,7 +892,7 @@
   marked working directory as branch silliness
   $ echo b >> b
   $ hg ci --close-branch -m'open and close'
-  abort: can only close branch heads
+  abort: branch "silliness" has no heads to close
   [255]
 
 Test that amend with --secret creates new secret changeset forcibly
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1678,7 +1678,7 @@
 raise error.Abort(_('current revision is already a branch closing'
 ' head'))
 elif not bheads:
-raise error.Abort(_('can only close branch heads'))
+raise error.Abort(_('branch "%s" has no heads to close') % branch)
 elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
   and not opts.get('force')):
 hint = _("use --force to close a non-head changeset")



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


D6491: commit: add a check if it is trying to close an already closed branch head

2019-06-15 Thread khanchi97 (Sushil khanchi)
khanchi97 retitled this revision from "branch: add a check if it is trying to 
close an already closed branch head" to "commit: add a check if it is trying to 
close an already closed branch head".
khanchi97 updated this revision to Diff 15532.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6491?vs=15381=15532

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6491/new/

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-branches.t

CHANGE DETAILS

diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -280,7 +280,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
   $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
-  abort: can only close branch heads
+  abort: current revision is already a branch closing head
   [255]
 
   $ hg log -r tip --debug
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1674,7 +1674,10 @@
 if opts.get('close_branch'):
 extra['close'] = '1'
 
-if not bheads:
+if repo['.'].closesbranch():
+raise error.Abort(_('current revision is already a branch closing'
+' head'))
+elif not bheads:
 raise error.Abort(_('can only close branch heads'))
 elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
   and not opts.get('force')):



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


D6490: branch: add --force flag to close branch from a not-head changeset

2019-06-10 Thread khanchi97 (Sushil khanchi)
khanchi97 marked an inline comment as done.
khanchi97 added a comment.


  In https://phab.mercurial-scm.org/D6490#94625, @mharbison72 wrote:
  
  > LGTM, thanks.
  >
  > Minor nit that I don't care too much about, but I'm wondering what others 
think of `not-head changeset` vs `non-head changeset`.  The latter sounds more 
natural to me, but I'm not sure if there's another example of this phrasing.
  
  
  Yes, I was also confused between these two phrasing when writing the patch. 
`non-head` sounds more natural to me too (not sure why I picked first one :P ). 
What others think about it?

REPOSITORY
  rHG Mercurial

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

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


D6490: branch: add --force flag to close branch from a not-head changeset

2019-06-10 Thread khanchi97 (Sushil khanchi)
khanchi97 marked an inline comment as done.
khanchi97 added inline comments.

INLINE COMMENTS

> mharbison72 wrote in commands.py:1680
> I didn't realize that `--force` wasn't already an option for commit, because 
> it is an option to internal commit functions.  I still like this idea, but 
> maybe you need to remove this from `opts` after completing the check here 
> (and also in the `--no-close-branch` case).  Otherwise, it risks bypassing 
> existing safeguards.
> 
> https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/localrepo.py#l2498
> 
> (I have no idea why that's allowed at all.  MQ maybe?)

Updated as per suggested changes. Also added a hint to use --force while 
aborting the user.

REPOSITORY
  rHG Mercurial

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

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


D6490: branch: add --force flag to close branch from a not-head changeset

2019-06-08 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 15380.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6490?vs=15363=15380

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-alias.t
  tests/test-branches.t
  tests/test-completion.t
  tests/test-qrecord.t
  tests/test-record.t

CHANGE DETAILS

diff --git a/tests/test-record.t b/tests/test-record.t
--- a/tests/test-record.t
+++ b/tests/test-record.t
@@ -52,6 +52,7 @@
   --amend   amend the parent of the working directory
-s --secret  use the secret phase for committing
-e --editinvoke editor on commit messages
+   -f --force   forcibly close branch from a not-head changeset
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
-m --message TEXTuse text as commit message
diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t
--- a/tests/test-qrecord.t
+++ b/tests/test-qrecord.t
@@ -69,6 +69,7 @@
   --amend   amend the parent of the working directory
-s --secret  use the secret phase for committing
-e --editinvoke editor on commit messages
+   -f --force   forcibly close branch from a not-head changeset
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
-m --message TEXTuse text as commit message
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -245,7 +245,7 @@
   bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
   cat: output, rev, decode, include, exclude, template
   clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, 
remotecmd, insecure
-  commit: addremove, close-branch, amend, secret, edit, interactive, include, 
exclude, message, logfile, date, user, subrepos
+  commit: addremove, close-branch, amend, secret, edit, force, interactive, 
include, exclude, message, logfile, date, user, subrepos
   config: untrusted, edit, local, global, template
   copy: after, force, include, exclude, dry-run
   debugancestor: 
diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -958,6 +958,7 @@
 it should abort:
   $ hg ci -m "closing branch" --close-branch
   abort: can only close branch heads
+  (use --force to close a not-head changeset)
   [255]
 
   $ hg up 0
@@ -972,3 +973,19 @@
   @  0: 9092f1db7931 added a
default
   
+Check --force to close a branch from a cset which is not a branch head
+
+  $ hg show stack --config extensions.show=
+o  1553 added c
+o  5f6d added b
+@  9092 added a
+
+without --force
+  $ hg ci -m "branch closed" --close-branch
+  abort: can only close branch heads
+  (use --force to close a not-head changeset)
+  [255]
+
+with --force
+  $ hg ci -m "branch closed" --close-branch --force
+  created new head
diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -120,6 +120,7 @@
   --amend   amend the parent of the working directory
-s --secret  use the secret phase for committing
-e --editinvoke editor on commit messages
+   -f --force   forcibly close branch from a not-head changeset
-i --interactive use interactive mode
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1583,6 +1583,7 @@
 ('', 'amend', None, _('amend the parent of the working directory')),
 ('s', 'secret', None, _('use the secret phase for committing')),
 ('e', 'edit', None, _('invoke editor on commit messages')),
+('f', 'force', None, _('forcibly close branch from a not-head changeset')),
 ('i', 'interactive', None, _('use interactive mode')),
 ] + walkopts + commitopts + commitopts2 + subrepoopts,
 _('[OPTION]... [FILE]...'),
@@ -1675,12 +1676,18 @@
 
 if not bheads:
 raise error.Abort(_('can only close branch heads'))
-elif branch == repo['.'].branch() and repo['.'].node() not in bheads:
-raise error.Abort(_('can only close branch heads'))
+elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
+  and not opts.get('force')):
+hint = _("use --force to close a not-head changeset")
+raise error.Abort(_('can only close branch heads'), hint=hint)
 elif opts.get('amend'):
 if (repo['.'].p1().branch() != branch and
 repo['.'].p2().branch() != branch):
 

D6493: branch: make the error message more specific while aborting branch closing

2019-06-08 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 15382.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6493?vs=15366=15382

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-commit-amend.t

CHANGE DETAILS

diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -892,7 +892,7 @@
   marked working directory as branch silliness
   $ echo b >> b
   $ hg ci --close-branch -m'open and close'
-  abort: can only close branch heads
+  abort: branch "silliness" has no heads to close
   [255]
 
 Test that amend with --secret creates new secret changeset forcibly
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1678,7 +1678,7 @@
 raise error.Abort(_('current revision is already a branch closing'
 ' head'))
 elif not bheads:
-raise error.Abort(_('can only close branch heads'))
+raise error.Abort(_('branch "%s" has no heads to close') % branch)
 elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
   and not opts.get('force')):
 hint = _("use --force to close a not-head changeset")



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


D6491: branch: add a check if it is trying to close an already closed branch head

2019-06-08 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 15381.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6491?vs=15364=15381

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-branches.t

CHANGE DETAILS

diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -280,7 +280,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
   $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
-  abort: can only close branch heads
+  abort: current revision is already a branch closing head
   [255]
 
   $ hg log -r tip --debug
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1674,7 +1674,10 @@
 if opts.get('close_branch'):
 extra['close'] = '1'
 
-if not bheads:
+if repo['.'].closesbranch():
+raise error.Abort(_('current revision is already a branch closing'
+' head'))
+elif not bheads:
 raise error.Abort(_('can only close branch heads'))
 elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
   and not opts.get('force')):



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


D6492: branch: add test covering the case when we have no branchheads to close

2019-06-07 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  Abandoned.. because I assumed this revision won't be pushed by `phabsend` as 
it's in secret phase. Is it right behavior?

REPOSITORY
  rHG Mercurial

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

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


D6493: branch: make the error message more specific while aborting branch closing

2019-06-07 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-commit-amend.t

CHANGE DETAILS

diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -892,7 +892,7 @@
   marked working directory as branch silliness
   $ echo b >> b
   $ hg ci --close-branch -m'open and close'
-  abort: can only close branch heads
+  abort: branch "silliness" has no heads to close
   [255]
 
 Test that amend with --secret creates new secret changeset forcibly
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1678,7 +1678,7 @@
 raise error.Abort(_('current revision is already a branch closing'
 ' head'))
 elif not bheads:
-raise error.Abort(_('can only close branch heads'))
+raise error.Abort(_('branch "%s" has no heads to close') % branch)
 elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
   and not opts.get('force')):
 raise error.Abort(_('can only close branch heads'))



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


D6490: branch: add --force flag to close branch from a not-head changeset

2019-06-07 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  While closing branch from a changeset which is not a branch head
  current implementation abort this action in every case but, there
  can be the situations where the changeset is not a local head but
  could be a remote head. This patch adds the functionality to bypass
  the "abort: can only close branch heads" by introducing --force flag.
  
  Added test case demonstrate the added behaviour.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-alias.t
  tests/test-branches.t
  tests/test-completion.t
  tests/test-qrecord.t
  tests/test-record.t

CHANGE DETAILS

diff --git a/tests/test-record.t b/tests/test-record.t
--- a/tests/test-record.t
+++ b/tests/test-record.t
@@ -52,6 +52,7 @@
   --amend   amend the parent of the working directory
-s --secret  use the secret phase for committing
-e --editinvoke editor on commit messages
+   -f --force   forcibly close branch from a not-head changeset
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
-m --message TEXTuse text as commit message
diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t
--- a/tests/test-qrecord.t
+++ b/tests/test-qrecord.t
@@ -69,6 +69,7 @@
   --amend   amend the parent of the working directory
-s --secret  use the secret phase for committing
-e --editinvoke editor on commit messages
+   -f --force   forcibly close branch from a not-head changeset
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
-m --message TEXTuse text as commit message
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -245,7 +245,7 @@
   bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
   cat: output, rev, decode, include, exclude, template
   clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, 
remotecmd, insecure
-  commit: addremove, close-branch, amend, secret, edit, interactive, include, 
exclude, message, logfile, date, user, subrepos
+  commit: addremove, close-branch, amend, secret, edit, force, interactive, 
include, exclude, message, logfile, date, user, subrepos
   config: untrusted, edit, local, global, template
   copy: after, force, include, exclude, dry-run
   debugancestor: 
diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -972,3 +972,18 @@
   @  0: 9092f1db7931 added a
default
   
+Check --force to close a branch from a cset which is not a branch head
+
+  $ hg show stack --config extensions.show=
+o  1553 added c
+o  5f6d added b
+@  9092 added a
+
+without --force
+  $ hg ci -m "branch closed" --close-branch
+  abort: can only close branch heads
+  [255]
+
+with --force
+  $ hg ci -m "branch closed" --close-branch --force
+  created new head
diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -120,6 +120,7 @@
   --amend   amend the parent of the working directory
-s --secret  use the secret phase for committing
-e --editinvoke editor on commit messages
+   -f --force   forcibly close branch from a not-head changeset
-i --interactive use interactive mode
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1583,6 +1583,7 @@
 ('', 'amend', None, _('amend the parent of the working directory')),
 ('s', 'secret', None, _('use the secret phase for committing')),
 ('e', 'edit', None, _('invoke editor on commit messages')),
+('f', 'force', None, _('forcibly close branch from a not-head changeset')),
 ('i', 'interactive', None, _('use interactive mode')),
 ] + walkopts + commitopts + commitopts2 + subrepoopts,
 _('[OPTION]... [FILE]...'),
@@ -1675,7 +1676,8 @@
 
 if not bheads:
 raise error.Abort(_('can only close branch heads'))
-elif branch == repo['.'].branch() and repo['.'].node() not in bheads:
+elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
+  and not opts.get('force')):
 raise error.Abort(_('can only close branch heads'))
 elif opts.get('amend'):
 if (repo['.'].p1().branch() != branch and



To: khanchi97, #hg-reviewers
Cc: 

D6491: branch: add a check if it is trying to close an already closed branch head

2019-06-07 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It would check if the revision we are going to close is already a
  closed branch head and print the error message accordingly.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-branches.t

CHANGE DETAILS

diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -280,7 +280,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
   $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
-  abort: can only close branch heads
+  abort: current revision is already a branch closing head
   [255]
 
   $ hg log -r tip --debug
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1674,7 +1674,10 @@
 if opts.get('close_branch'):
 extra['close'] = '1'
 
-if not bheads:
+if repo['.'].closesbranch():
+raise error.Abort(_('current revision is already a branch closing'
+' head'))
+elif not bheads:
 raise error.Abort(_('can only close branch heads'))
 elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
   and not opts.get('force')):



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


D6492: branch: add test covering the case when we have no branchheads to close

2019-06-07 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-branches.t

CHANGE DETAILS

diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -987,3 +987,30 @@
 with --force
   $ hg ci -m "branch closed" --close-branch --force
   created new head
+
+Test which adds coverage for the case when we got no heads from branchheads():
+-
+
+  $ hg up -r "desc('added c')"
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg branch feature
+  marked working directory as branch feature
+  (branches are permanent and global, did you want a bookmark?)
+
+  $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
+  _  3: 0c72c83f0f75 branch closed
+  |default
+  |
+  | @  2: 155349b645be added c
+  | |  default
+  | |
+  | o  1: 5f6d8a4bf34a added b
+  |/   default
+  |
+  o  0: 9092f1db7931 added a
+   default
+  
+XXX: we could have a more specific message here that current branch has no 
heads
+  $ hg ci -m "closing branch" --close-branch
+  abort: can only close branch heads
+  [255]



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


Re: D6282: branch: abort if closing branch from a non-branchhead cset

2019-05-17 Thread Sushil Khanchi
I am +1 with adding the `--force` option to override the abort as it seems
the better option than
1) warning message (as it would change the repo anyway)
2) adding a message in commit editor. (hard to notice)

I will send a patch for it. Let me know if you have a different opinion on
this :-)

On Thu, May 9, 2019 at 8:53 AM Matt Harbison  wrote:

> On Sun, 05 May 2019 14:13:16 -0400, Pierre-Yves David
>  wrote:
>
> >
> >
> > On 5/1/19 11:18 PM, Sushil Khanchi wrote:
> >> .
> >>  On Wed, May 1, 2019 at 9:22 PM Pierre-Yves David
> >>  >> <mailto:pierre-yves.da...@ens-lyon.org>> wrote:
> >>  .
> >>  On 5/1/19 2:14 PM, Sushil Khanchi wrote:
> >>  > .
> >>  >
> >>  > On Wed, May 1, 2019 at 5:14 PM Pierre-Yves David
> >>  >  >> <mailto:pierre-yves.da...@ens-lyon.org>
> >> <mailto:pierre-yves.da...@ens-lyon.org
> >> <mailto:pierre-yves.da...@ens-lyon.org>>>
> >>  > wrote:
> >>  >
> >>  >
> >>  >
> >>  > On 5/1/19 1:14 PM, Sushil Khanchi wrote:
> >>  >  > .
> >>  >  >
> >>  >  > On Fri, Apr 26, 2019 at 8:29 PM Pierre-Yves David
> >>  >  >  >> <mailto:pierre-yves.da...@ens-lyon.org>
> >>  > <mailto:pierre-yves.da...@ens-lyon.org
> >> <mailto:pierre-yves.da...@ens-lyon.org>>
> >>  > <mailto:pierre-yves.da...@ens-lyon.org
> >> <mailto:pierre-yves.da...@ens-lyon.org>
> >>  > <mailto:pierre-yves.da...@ens-lyon.org
> >> <mailto:pierre-yves.da...@ens-lyon.org>>>>
> >>  >  > wrote:
> >>  >  >
> >>  >  >
> >>  >  >
> >>  >  > On 4/19/19 9:49 AM, khanchi97 (Sushil khanchi) wrote:
> >>  >  >  > khanchi97 created this revision.
> >>  >  >  > Herald added a subscriber: mercurial-devel.
> >>  >  >  > Herald added a reviewer: hg-reviewers.
> >>  >  >  >
> >>  >  >  > REVISION SUMMARY
> >>  >  >  >This patch make sure that we abort if the user
> >> is trying to
> >>  >  >  >close a branch from a cset which is not a branch
> >> head.
> >>  >  >  >Changes in test file reflect the fixed
> >> behaviour.
> >>  >  >
> >>  >  > Is there a way to override this ? There can be
> >> situation
> >>  > where the
> >>  >  > changeset is not a local head but could be a remote
> >> head.
> >>  >  >
> >>  >  > By closing remote head, you mean first close that locally
> >> (where
> >>  > it is
> >>  >  > not a head) and push that to a remote (where it is a
> >> head)?
> >>  >
> >>  > Yes
> >>  >
> >>  > I don't think in present code there is any way to override this.
> >> Do you
> >>  > have any idea? Or any other place in mercurial you remember
> >> where we
> >>  > handle similar situation?
> >>  > And just for knowledge I would like to know how often
> developers
> >> use
> >>  > this remote head closing thing (when locally it is not a head)?
> >>  Something similar coming to mind is `hg tag`. It will -warn- when
> >> tagging a non-head but will still tag. Maybe we should align on this
> >> (warning instead of aborting)
> >>   How about prompting the user to confirm? One upside in prompting I
> >> see is that user don't have to run `hg strip/prune`. Also the downside
> >> is it requires user intervention.
> >
> > prompt are usually not a great user experience.
>
> Maybe require `--force` to override the abort?  I don't necessarily care
> for prompts either, but the tag behavior always struck me as weird- it
> warns, but it makes changes to the repo anyway and the stock hg
> configuration doesn't let you edit history to fix it.
>
> > I lean toward saying "lets have a user experience similar to `hg tag`".
> > Alternatively, we could have a warning early. For example, if the
> commit
> > message editor had a line about adding a new heads/closing non-head,
> > this would be a clear win.
>
> I typically don't notice what else is in the commit message editor,
> unless
> while writing the commit, I start to doubt what files I named.
>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: Google Summer of Code 2019.

2019-05-09 Thread Sushil Khanchi
Congratulations Taapas and Navaneeth,

I am very excited to work with you and hoping for great summers ahead.
Let's get started :-)

On Thu, May 9, 2019 at 6:15 PM Pulkit Goyal <7895pul...@gmail.com> wrote:

> Hi everyone,
>
> Hope you are doing well.
>
> The results for summer of code are out. We have two students working with
> us this summer.
>
> 1) Taapas Agrawal will be working on implementing `hg continue`, `hg
> abort` commands and also `hg update --continue`.
> https://summerofcode.withgoogle.com/projects/#5132139832541184
>
> 2) Navaneeth Suresh will be working on implementing functionality to store
> unresolved merge state
> https://summerofcode.withgoogle.com/projects/#4705545963962368
>
> Both the students are pretty active in the community and already
> contributed good number of patches and hence don't need any kind of welcome
> ;)
>
> Sushil, Sangeet and me will be mentoring both of them. The primarily role
> of mentors is to integrate students in the community. So, only we three
> talking and helping students will not be sufficient.
>
> Community Bonding period has started, so I strongly recommend discussing
> projects with the students.
>
> Thanks and Regards
> Pulkit
>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D6282: branch: abort if closing branch from a non-branchhead cset

2019-05-01 Thread Sushil Khanchi
.

On Wed, May 1, 2019 at 9:22 PM Pierre-Yves David <
pierre-yves.da...@ens-lyon.org> wrote:

> .
>
> On 5/1/19 2:14 PM, Sushil Khanchi wrote:
> > .
> >
> > On Wed, May 1, 2019 at 5:14 PM Pierre-Yves David
> > mailto:pierre-yves.da...@ens-lyon.org>>
>
> > wrote:
> >
> >
> >
> > On 5/1/19 1:14 PM, Sushil Khanchi wrote:
> >  > .
> >  >
> >  > On Fri, Apr 26, 2019 at 8:29 PM Pierre-Yves David
> >  >  > <mailto:pierre-yves.da...@ens-lyon.org>
> > <mailto:pierre-yves.da...@ens-lyon.org
> > <mailto:pierre-yves.da...@ens-lyon.org>>>
> >  > wrote:
> >  >
> >  >
> >  >
> >  > On 4/19/19 9:49 AM, khanchi97 (Sushil khanchi) wrote:
> >  >  > khanchi97 created this revision.
> >  >  > Herald added a subscriber: mercurial-devel.
> >  >  > Herald added a reviewer: hg-reviewers.
> >  >  >
> >  >  > REVISION SUMMARY
> >  >  >This patch make sure that we abort if the user is
> trying to
> >  >  >close a branch from a cset which is not a branch head.
> >  >  >Changes in test file reflect the fixed behaviour.
> >  >
> >  > Is there a way to override this ? There can be situation
> > where the
> >  > changeset is not a local head but could be a remote head.
> >  >
> >  > By closing remote head, you mean first close that locally (where
> > it is
> >  > not a head) and push that to a remote (where it is a head)?
> >
> > Yes
> >
> > I don't think in present code there is any way to override this. Do you
> > have any idea? Or any other place in mercurial you remember where we
> > handle similar situation?
> > And just for knowledge I would like to know how often developers use
> > this remote head closing thing (when locally it is not a head)?
>
> Something similar coming to mind is `hg tag`. It will -warn- when
> tagging a non-head but will still tag. Maybe we should align on this
> (warning instead of aborting)
>

How about prompting the user to confirm? One upside in prompting I see is
that user don't have to run `hg strip/prune`. Also the downside is it
requires user intervention.

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


Re: D6282: branch: abort if closing branch from a non-branchhead cset

2019-05-01 Thread Sushil Khanchi
.

On Wed, May 1, 2019 at 5:14 PM Pierre-Yves David <
pierre-yves.da...@ens-lyon.org> wrote:

>
>
> On 5/1/19 1:14 PM, Sushil Khanchi wrote:
> > .
> >
> > On Fri, Apr 26, 2019 at 8:29 PM Pierre-Yves David
> > mailto:pierre-yves.da...@ens-lyon.org>>
>
> > wrote:
> >
> >
> >
> > On 4/19/19 9:49 AM, khanchi97 (Sushil khanchi) wrote:
> >  > khanchi97 created this revision.
> >  > Herald added a subscriber: mercurial-devel.
> >  > Herald added a reviewer: hg-reviewers.
> >  >
> >  > REVISION SUMMARY
> >  >This patch make sure that we abort if the user is trying to
> >  >close a branch from a cset which is not a branch head.
> >  >Changes in test file reflect the fixed behaviour.
> >
> > Is there a way to override this ? There can be situation where the
> > changeset is not a local head but could be a remote head.
> >
> > By closing remote head, you mean first close that locally (where it is
> > not a head) and push that to a remote (where it is a head)?
>
> Yes
>
I don't think in present code there is any way to override this. Do you
have any idea? Or any other place in mercurial you remember where we handle
similar situation?
And just for knowledge I would like to know how often developers use this
remote head closing thing (when locally it is not a head)?


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


Re: D6282: branch: abort if closing branch from a non-branchhead cset

2019-05-01 Thread Sushil Khanchi
.

On Fri, Apr 26, 2019 at 8:29 PM Pierre-Yves David <
pierre-yves.da...@ens-lyon.org> wrote:

>
>
> On 4/19/19 9:49 AM, khanchi97 (Sushil khanchi) wrote:
> > khanchi97 created this revision.
> > Herald added a subscriber: mercurial-devel.
> > Herald added a reviewer: hg-reviewers.
> >
> > REVISION SUMMARY
> >This patch make sure that we abort if the user is trying to
> >close a branch from a cset which is not a branch head.
> >Changes in test file reflect the fixed behaviour.
>
> Is there a way to override this ? There can be situation where the
> changeset is not a local head but could be a remote head.
>
By closing remote head, you mean first close that locally (where it is not
a head) and push that to a remote (where it is a head)?


> >
> > REPOSITORY
> >rHG Mercurial
> >
> > REVISION DETAIL
> >https://phab.mercurial-scm.org/D6282
> >
> > AFFECTED FILES
> >mercurial/commands.py
> >tests/test-branches.t
> >
> > CHANGE DETAILS
> >
> > diff --git a/tests/test-branches.t b/tests/test-branches.t
> > --- a/tests/test-branches.t
> > +++ b/tests/test-branches.t
> > @@ -956,19 +956,16 @@
> >
> >   trying to close branch from a cset which is not a branch head
> >   it should abort:
> > -XXX: it should have aborted here
> > $ hg ci -m "closing branch" --close-branch
> > -  created new head
> > +  abort: can only close branch heads
> > +  [255]
> >
> > $ hg up 0
> > 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
> > $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
> > -  _  3: 006876ddd20e closing branch
> > +  o  2: 155349b645be added c
> > | default
> > |
> > -  | o  2: 155349b645be added c
> > -  |/ default
> > -  |
> > o  1: 5f6d8a4bf34a added b
> > | default
> > |
> > diff --git a/mercurial/commands.py b/mercurial/commands.py
> > --- a/mercurial/commands.py
> > +++ b/mercurial/commands.py
> > @@ -1675,6 +1675,8 @@
> >
> >   if not bheads:
> >   raise error.Abort(_('can only close branch heads'))
> > +elif branch == repo['.'].branch() and repo['.'].node() not in
> bheads:
> > +raise error.Abort(_('can only close branch heads'))
> >   elif opts.get('amend'):
> >   if (repo['.'].p1().branch() != branch and
> >   repo['.'].p2().branch() != branch):
> >
> >
> >
> > To: khanchi97, #hg-reviewers
> > Cc: mercurial-devel
> > ___
> > Mercurial-devel mailing list
> > Mercurial-devel@mercurial-scm.org
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> >
>
> --
> Pierre-Yves David
> ___
> 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


D6282: branch: abort if closing branch from a non-branchhead cset

2019-04-25 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8d14d91584f1: branch: abort if closing branch from a 
non-branchhead cset (authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6282?vs=14859=14924

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-branches.t

CHANGE DETAILS

diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -956,19 +956,16 @@
 
 trying to close branch from a cset which is not a branch head
 it should abort:
-XXX: it should have aborted here
   $ hg ci -m "closing branch" --close-branch
-  created new head
+  abort: can only close branch heads
+  [255]
 
   $ hg up 0
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
-  _  3: 006876ddd20e closing branch
+  o  2: 155349b645be added c
   |default
   |
-  | o  2: 155349b645be added c
-  |/   default
-  |
   o  1: 5f6d8a4bf34a added b
   |default
   |
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1675,6 +1675,8 @@
 
 if not bheads:
 raise error.Abort(_('can only close branch heads'))
+elif branch == repo['.'].branch() and repo['.'].node() not in bheads:
+raise error.Abort(_('can only close branch heads'))
 elif opts.get('amend'):
 if (repo['.'].p1().branch() != branch and
 repo['.'].p2().branch() != branch):



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


D6281: branch: add tests which shows branch can be closed from a non-branchhead cset

2019-04-25 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG258821f2d465: branch: add tests which shows branch can be 
closed from a non-branchhead cset (authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6281?vs=14858=14923

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

AFFECTED FILES
  tests/test-branches.t

CHANGE DETAILS

diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -940,3 +940,38 @@
   0010: 56 46 78 69 00 00 00 01 |VFxi|
 
   $ cd ..
+
+Test to make sure that `--close-branch` only works on a branch head:
+
+  $ hg init closebranch
+  $ cd closebranch
+  $ for ch in a b c; do
+  > echo $ch > $ch
+  > hg add $ch
+  > hg ci -m "added "$ch
+  > done;
+
+  $ hg up -r "desc('added b')"
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+trying to close branch from a cset which is not a branch head
+it should abort:
+XXX: it should have aborted here
+  $ hg ci -m "closing branch" --close-branch
+  created new head
+
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
+  _  3: 006876ddd20e closing branch
+  |default
+  |
+  | o  2: 155349b645be added c
+  |/   default
+  |
+  o  1: 5f6d8a4bf34a added b
+  |default
+  |
+  @  0: 9092f1db7931 added a
+   default
+  



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


D6281: branch: add tests which shows branch can be closed from a non-branchhead cset

2019-04-25 Thread khanchi97 (Sushil khanchi)
khanchi97 added inline comments.

INLINE COMMENTS

> test-branches.t:961
> +  $ hg ci -m "closing branch" --close-branch
> +  created new head
> +

I created this patch assuming that hg should not allow to create a branch 
closing commit from a cset which is not a branch head. Let me know if I am 
missing something here.

REPOSITORY
  rHG Mercurial

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

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


D6282: branch: abort if closing branch from a non-branchhead cset

2019-04-19 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch make sure that we abort if the user is trying to
  close a branch from a cset which is not a branch head.
  Changes in test file reflect the fixed behaviour.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-branches.t

CHANGE DETAILS

diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -956,19 +956,16 @@
 
 trying to close branch from a cset which is not a branch head
 it should abort:
-XXX: it should have aborted here
   $ hg ci -m "closing branch" --close-branch
-  created new head
+  abort: can only close branch heads
+  [255]
 
   $ hg up 0
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
-  _  3: 006876ddd20e closing branch
+  o  2: 155349b645be added c
   |default
   |
-  | o  2: 155349b645be added c
-  |/   default
-  |
   o  1: 5f6d8a4bf34a added b
   |default
   |
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1675,6 +1675,8 @@
 
 if not bheads:
 raise error.Abort(_('can only close branch heads'))
+elif branch == repo['.'].branch() and repo['.'].node() not in bheads:
+raise error.Abort(_('can only close branch heads'))
 elif opts.get('amend'):
 if (repo['.'].p1().branch() != branch and
 repo['.'].p2().branch() != branch):



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


D6281: branch: add tests which shows branch can be closed from a non-branchhead cset

2019-04-19 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch shows that we can close a branch even from a cset which is not
  a branch head. It was supposed to abort this operation.
  Next patch will be fixing the issue.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-branches.t

CHANGE DETAILS

diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -940,3 +940,38 @@
   0010: 56 46 78 69 00 00 00 01 |VFxi|
 
   $ cd ..
+
+Test to make sure that `--close-branch` only works on a branch head:
+
+  $ hg init closebranch
+  $ cd closebranch
+  $ for ch in a b c; do
+  > echo $ch > $ch
+  > hg add $ch
+  > hg ci -m "added "$ch
+  > done;
+
+  $ hg up -r "desc('added b')"
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+trying to close branch from a cset which is not a branch head
+it should abort:
+XXX: it should have aborted here
+  $ hg ci -m "closing branch" --close-branch
+  created new head
+
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
+  _  3: 006876ddd20e closing branch
+  |default
+  |
+  | o  2: 155349b645be added c
+  |/   default
+  |
+  o  1: 5f6d8a4bf34a added b
+  |default
+  |
+  @  0: 9092f1db7931 added a
+   default
+  



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


D6058: patch: include flag-only file changes in "special" while filtering patch (issue5864)

2019-03-18 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6308aa828cf4: patch: include flag-only file changes in 
special while filtering patch… (authored by khanchi97, committed by 
).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6058?vs=14524=14551

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

AFFECTED FILES
  mercurial/patch.py
  tests/test-split.t

CHANGE DETAILS

diff --git a/tests/test-split.t b/tests/test-split.t
--- a/tests/test-split.t
+++ b/tests/test-split.t
@@ -732,30 +732,33 @@
   
 
 #if no-windows
-  $ printf 'y\ny\ny\n' | hg split
-  diff --git a/foo b/foo
-  old mode 100644
-  new mode 100755
-  examine changes to 'foo'? [Ynesfdaq?] y
-  
-  no changes to record
+  $ cat > $TESTTMP/messages < split 1
+  > EOF
+  $ printf 'y\n' | hg split
   diff --git a/foo b/foo
   old mode 100644
   new mode 100755
   examine changes to 'foo'? [Ynesfdaq?] y
   
-  no changes to record
-  diff --git a/foo b/foo
-  old mode 100644
-  new mode 100755
-  examine changes to 'foo'? [Ynesfdaq?] y
+  EDITOR: HG: Splitting 3a2125f0f4cb. Write commit message for the first split 
changeset.
+  EDITOR: make executable
+  EDITOR: 
+  EDITOR: 
+  EDITOR: HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+  EDITOR: HG: Leave message empty to abort commit.
+  EDITOR: HG: --
+  EDITOR: HG: user: test
+  EDITOR: HG: branch 'default'
+  EDITOR: HG: changed foo
+  created new head
+  saved backup bundle to 
$TESTTMP/issue5864/.hg/strip-backup/3a2125f0f4cb-629e4432-split.hg 
(obsstore-off !)
+
+  $ hg log -G -T "{node|short} {desc}\n"
+  @  b154670c87da split 1
+  |
+  o  51f273a58d82 initial
   
-  no changes to record
-  diff --git a/foo b/foo
-  old mode 100644
-  new mode 100755
-  examine changes to 'foo'? [Ynesfdaq?] abort: response expected
-  [255]
 #else
 
 TODO: Fix this on Windows. See issue 2020 and 5883
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -863,7 +863,7 @@
 diff_re = re.compile('diff -r .* (.*)$')
 allhunks_re = re.compile('(?:index|deleted file) ')
 pretty_re = re.compile('(?:new file|deleted file) ')
-special_re = re.compile('(?:index|deleted|copy|rename) ')
+special_re = re.compile('(?:index|deleted|copy|rename|new mode) ')
 newfile_re = re.compile('(?:new file)')
 
 def __init__(self, header):



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


D6058: patch: include flag-only file changes in "special" while filtering patch (issue5864)

2019-03-16 Thread khanchi97 (Sushil khanchi)
khanchi97 marked an inline comment as done.
khanchi97 added a comment.


  Thanks, it is more clear now.

REPOSITORY
  rHG Mercurial

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

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


D6058: patch: include flag-only file changes in "special" while filtering patch (issue5864)

2019-03-16 Thread khanchi97 (Sushil khanchi)
khanchi97 marked an inline comment as done.
khanchi97 added inline comments.

INLINE COMMENTS

> mharbison72 wrote in test-split.t:744
> This happens because you can't have nested `#if`.  i.e. this doesn't work:
> 
>   #if ..
>   ...
>   #if ..
>   ...
>   #endif
>   #endif
> 
> You can list multiple requirements on a line, and it is effectively `&&` IIRC.
> 
> I don't see any obvious differences in the output though, other that the 
> bundle saving in the `obsstore-off` case.  I think what you can do here is 
> conditionalize just that line by appending ` (obsstore-off !)` to it the way 
> you would a `(!)`, `(glob)`, or whatever.  That means it must be there for 
> `obsstore-off`.  Conditionalizing the output also makes it easier to see the 
> differences between the difference cases in general.

Thanks, I have updated the patch. I though it is required to a test in this 
file to run with both the cases `(obsstore-[on|off])`. I have also removed rev 
no. from graph log as output differed because of stripping.

REPOSITORY
  rHG Mercurial

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

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


D6058: patch: include flag-only file changes in "special" while filtering patch (issue5864)

2019-03-16 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 14524.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6058?vs=14485=14524

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

AFFECTED FILES
  mercurial/patch.py
  tests/test-split.t

CHANGE DETAILS

diff --git a/tests/test-split.t b/tests/test-split.t
--- a/tests/test-split.t
+++ b/tests/test-split.t
@@ -732,30 +732,33 @@
   
 
 #if no-windows
-  $ printf 'y\ny\ny\n' | hg split
-  diff --git a/foo b/foo
-  old mode 100644
-  new mode 100755
-  examine changes to 'foo'? [Ynesfdaq?] y
-  
-  no changes to record
+  $ cat > $TESTTMP/messages < split 1
+  > EOF
+  $ printf 'y\n' | hg split
   diff --git a/foo b/foo
   old mode 100644
   new mode 100755
   examine changes to 'foo'? [Ynesfdaq?] y
   
-  no changes to record
-  diff --git a/foo b/foo
-  old mode 100644
-  new mode 100755
-  examine changes to 'foo'? [Ynesfdaq?] y
+  EDITOR: HG: Splitting 3a2125f0f4cb. Write commit message for the first split 
changeset.
+  EDITOR: make executable
+  EDITOR: 
+  EDITOR: 
+  EDITOR: HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+  EDITOR: HG: Leave message empty to abort commit.
+  EDITOR: HG: --
+  EDITOR: HG: user: test
+  EDITOR: HG: branch 'default'
+  EDITOR: HG: changed foo
+  created new head
+  saved backup bundle to 
$TESTTMP/issue5864/.hg/strip-backup/3a2125f0f4cb-629e4432-split.hg 
(obsstore-off !)
+
+  $ hg log -G -T "{node|short} {desc}\n"
+  @  b154670c87da split 1
+  |
+  o  51f273a58d82 initial
   
-  no changes to record
-  diff --git a/foo b/foo
-  old mode 100644
-  new mode 100755
-  examine changes to 'foo'? [Ynesfdaq?] abort: response expected
-  [255]
 #else
 
 TODO: Fix this on Windows. See issue 2020 and 5883
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -863,7 +863,7 @@
 diff_re = re.compile('diff -r .* (.*)$')
 allhunks_re = re.compile('(?:index|deleted file) ')
 pretty_re = re.compile('(?:new file|deleted file) ')
-special_re = re.compile('(?:index|deleted|copy|rename) ')
+special_re = re.compile('(?:index|deleted|copy|rename|new mode) ')
 newfile_re = re.compile('(?:new file)')
 
 def __init__(self, header):



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


Re: D6128: chistedit:improve location of highlighted cursor.(issue6073)

2019-03-14 Thread Sushil Khanchi
Please remove unnecessary blank lines added/removed in your patch. Your
patch should contain the changed related to the issue only. You can always
look at the changes a patch contains using `hg log -p -r rev`.

On Thu, Mar 14, 2019 at 1:44 AM akshjain.jain74 (Akshit Jain) <
phabrica...@mercurial-scm.org> wrote:

> akshjain.jain74 created this revision.
> Herald added a reviewer: durin42.
> Herald added a subscriber: mercurial-devel.
> Herald added a reviewer: hg-reviewers.
>
> REPOSITORY
>   rHG Mercurial
>
> REVISION DETAIL
>   https://phab.mercurial-scm.org/D6128
>
> AFFECTED FILES
>   hgext/histedit.py
>   hgext/pager.py
>   mercurial/dispatch.py
>   mercurial/scmutil.py
>
> CHANGE DETAILS
>
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -45,6 +45,7 @@
>  vfs,
>  )
>
> +
>  from .utils import (
>  procutil,
>  stringutil,
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -18,7 +18,6 @@
>  import time
>  import traceback
>
> -
>  from .i18n import _
>
>  from hgdemandimport import tracing
> diff --git a/hgext/pager.py b/hgext/pager.py
> --- a/hgext/pager.py
> +++ b/hgext/pager.py
> @@ -31,6 +31,7 @@
>  registrar,
>  )
>
> +
>  # Note for extension authors: ONLY specify testedwith =
> 'ships-with-hg-core' for
>  # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
>  # be specifying the version(s) of Mercurial they are tested with, or
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -1124,7 +1124,7 @@
>  if next:
>  index += 1
>  else:
> -index -= 1
> +index += 1
>  changeaction(state, pos, KEY_LIST[index % len(KEY_LIST)])
>
>  def changeview(state, delta, unit):
> @@ -1164,12 +1164,12 @@
>  if action is None:
>  return
>  if action in ('down', 'move-down'):
> -newpos = min(oldpos + 1, len(rules) - 1)
> +newpos = min(oldpos+1 , len(rules) - 1)
>  movecursor(state, oldpos, newpos)
>  if selected is not None or action == 'move-down':
>  swap(state, oldpos, newpos)
>  elif action in ('up', 'move-up'):
> -newpos = max(0, oldpos - 1)
> +newpos = max(0, oldpos-1)
>  movecursor(state, oldpos, newpos)
>  if selected is not None or action == 'move-up':
>  swap(state, oldpos, newpos)
>
>
>
> To: akshjain.jain74, durin42, #hg-reviewers
> Cc: mercurial-devel
> ___
> 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


D6058: patch: include flag-only file changes in "special" while filtering patch (issue5864)

2019-03-13 Thread khanchi97 (Sushil khanchi)
khanchi97 added inline comments.

INLINE COMMENTS

> test-split.t:734
>  
> -#if no-windows
> +#if windows
> +TODO: Fix this on Windows. See issue 2020 and 5883

I moved the part when on windows (#if windows) at the top because I found it 
easy to include nested conditions then.

REPOSITORY
  rHG Mercurial

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

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


D6058: patch: include flag-only file changes in "special" while filtering patch (issue5864)

2019-03-13 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 14485.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6058?vs=14323=14485

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

AFFECTED FILES
  mercurial/patch.py
  tests/test-split.t

CHANGE DETAILS

diff --git a/tests/test-split.t b/tests/test-split.t
--- a/tests/test-split.t
+++ b/tests/test-split.t
@@ -731,36 +731,64 @@
   o  0:51f273a58d82 initial
   
 
-#if no-windows
+#if windows
+TODO: Fix this on Windows. See issue 2020 and 5883
+
   $ printf 'y\ny\ny\n' | hg split
-  diff --git a/foo b/foo
-  old mode 100644
-  new mode 100755
-  examine changes to 'foo'? [Ynesfdaq?] y
-  
-  no changes to record
+  abort: cannot split an empty revision
+  [255]
+#else
+  $ cat > $TESTTMP/messages < split 1
+  > EOF
+  !!! nested #if
+#if obsstore-on
+  $ printf 'y\n' | hg split
   diff --git a/foo b/foo
   old mode 100644
   new mode 100755
   examine changes to 'foo'? [Ynesfdaq?] y
   
-  no changes to record
+  EDITOR: HG: Splitting 3a2125f0f4cb. Write commit message for the first split 
changeset.
+  EDITOR: make executable
+  EDITOR: 
+  EDITOR: 
+  EDITOR: HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+  EDITOR: HG: Leave message empty to abort commit.
+  EDITOR: HG: --
+  EDITOR: HG: user: test
+  EDITOR: HG: branch 'default'
+  EDITOR: HG: changed foo
+  created new head
+
+  $ hg glog
+  @  2:b154670c87da split 1
+  |
+  o  0:51f273a58d82 initial
+  
+#else
+  $ printf 'y\n' | hg split
   diff --git a/foo b/foo
   old mode 100644
   new mode 100755
   examine changes to 'foo'? [Ynesfdaq?] y
   
-  no changes to record
-  diff --git a/foo b/foo
-  old mode 100644
-  new mode 100755
-  examine changes to 'foo'? [Ynesfdaq?] abort: response expected
-  [255]
-#else
+  EDITOR: HG: Splitting 3a2125f0f4cb. Write commit message for the first split 
changeset.
+  EDITOR: make executable
+  EDITOR: 
+  EDITOR: 
+  EDITOR: HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+  EDITOR: HG: Leave message empty to abort commit.
+  EDITOR: HG: --
+  EDITOR: HG: user: test
+  EDITOR: HG: branch 'default'
+  EDITOR: HG: changed foo
+  created new head
+  saved backup bundle to 
$TESTTMP/issue5864/.hg/strip-backup/3a2125f0f4cb-629e4432-split.hg
 
-TODO: Fix this on Windows. See issue 2020 and 5883
-
-  $ printf 'y\ny\ny\n' | hg split
-  abort: cannot split an empty revision
-  [255]
+  $ hg glog
+  @  1:b154670c87da split 1
+  |
+  o  0:51f273a58d82 initial
+  
 #endif
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -863,7 +863,7 @@
 diff_re = re.compile('diff -r .* (.*)$')
 allhunks_re = re.compile('(?:index|deleted file) ')
 pretty_re = re.compile('(?:new file|deleted file) ')
-special_re = re.compile('(?:index|deleted|copy|rename) ')
+special_re = re.compile('(?:index|deleted|copy|rename|new mode) ')
 newfile_re = re.compile('(?:new file)')
 
 def __init__(self, header):



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


D5963: copies: handle a case when both merging csets are not descendant of merge base

2019-03-11 Thread khanchi97 (Sushil khanchi)
khanchi97 added inline comments.

INLINE COMMENTS

> martinvonz wrote in copies.py:571
> I am also still not sure, even after spending several hours on this code :( 
> But I am also not sure it's incorrect, and I don't want to hold up this patch 
> more than I already have, so I'll queue this. Thanks for your patience. As I 
> said before, I'm going to write a changeset-centric version of 
> `mergecopies()` pretty soon, and then I'll have to understand this better. 
> I'll also add more tests then. (I'm not trying to say that I think your patch 
> is broken; it's just that the entire `mergecopies()` is pretty complicated, 
> so I wouldn't be surprised if there are bugs anywhere in it.)

Yeah, I think I understand what you said. Thanks for accepting the patch :-)

REPOSITORY
  rHG Mercurial

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

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


D5963: copies: handle a case when both merging csets are not descendant of merge base

2019-03-11 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7694b685bb10: copies: handle a case when both merging csets 
are not descendant of merge base (authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5963?vs=14457=14460

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -554,8 +554,9 @@
   b
  +baba
   
-Test which demonstrate that fullcopytracing algorithm can fail to handle a 
case when both the csets are dirty
---
+Test to make sure that fullcopytracing algorithm don't fail when both the 
merging csets are dirty
+(a dirty cset is one who is not the descendant of merge base)
+-
 
   $ newrepo
   $ echo a > a
@@ -628,6 +629,5 @@
 Now if we trigger a merge between cset revision 3 and 6 using base revision 4, 
in this case
 both the merging csets will be dirty as no one is descendent of base revision:
 
-  $ hg graft -r 6 --base 4 --hidden 2>&1 | grep "AssertionError"
-  AssertionError
-
+  $ hg graft -r 6 --base 4 --hidden -t :other
+  grafting 6:99802e4f1e46 "added willconflict and d" (tip)
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -608,7 +608,7 @@
 if dirtyc1:
 _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge,
incompletediverge)
-else:
+if dirtyc2:
 _combinecopies(data1['incomplete'], data2['incomplete'], copy, diverge,
incompletediverge)
 
@@ -647,7 +647,13 @@
 for f in bothnew:
 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1)
 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2)
-if dirtyc1:
+if dirtyc1 and dirtyc2:
+remainder = _combinecopies(both2['incomplete'], both1['incomplete'],
+   copy, bothdiverge, bothincompletediverge)
+remainder1 = _combinecopies(both1['incomplete'], both2['incomplete'],
+   copy, bothdiverge, bothincompletediverge)
+remainder.update(remainder1)
+elif dirtyc1:
 # incomplete copies may only be found on the "dirty" side for bothnew
 assert not both2['incomplete']
 remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge,



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


D5962: copies: add test that makes both the merging csets dirty and fails

2019-03-11 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfc4b7a46fda1: copies: add test that makes both the merging 
csets dirty and fails (authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5962?vs=14456=14459

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

AFFECTED FILES
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -1,6 +1,8 @@
 #testcases filelog compatibility
 
   $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > rebase=
   > [alias]
   > l = log -G -T '{rev} {desc}\n{files}\n'
   > EOF
@@ -552,3 +554,80 @@
   b
  +baba
   
+Test which demonstrate that fullcopytracing algorithm can fail to handle a 
case when both the csets are dirty
+--
+
+  $ newrepo
+  $ echo a > a
+  $ hg add a
+  $ hg ci -m "added a"
+  $ echo b > b
+  $ hg add b
+  $ hg ci -m "added b"
+
+  $ echo foobar > willconflict
+  $ hg add willconflict
+  $ hg ci -m "added willconflict"
+  $ echo c > c
+  $ hg add c
+  $ hg ci -m "added c"
+
+  $ hg l
+  @  3 added c
+  |  c
+  o  2 added willconflict
+  |  willconflict
+  o  1 added b
+  |  b
+  o  0 added a
+ a
+
+  $ hg up ".^^"
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo d > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ echo barfoo > willconflict
+  $ hg add willconflict
+  $ hg ci --amend -m "added willconflict and d"
+
+  $ hg l
+  @  5 added willconflict and d
+  |  d willconflict
+  | o  3 added c
+  | |  c
+  | o  2 added willconflict
+  |/   willconflict
+  o  1 added b
+  |  b
+  o  0 added a
+ a
+
+  $ hg rebase -r . -d 2 -t :other
+  rebasing 5:5018b1509e94 "added willconflict and d" (tip)
+
+  $ hg up 3 -q
+  $ hg l --hidden
+  o  6 added willconflict and d
+  |  d willconflict
+  | x  5 added willconflict and d
+  | |  d willconflict
+  | | x  4 added d
+  | |/   d
+  +---@  3 added c
+  | |c
+  o |  2 added willconflict
+  |/   willconflict
+  o  1 added b
+  |  b
+  o  0 added a
+ a
+
+Now if we trigger a merge between cset revision 3 and 6 using base revision 4, 
in this case
+both the merging csets will be dirty as no one is descendent of base revision:
+
+  $ hg graft -r 6 --base 4 --hidden 2>&1 | grep "AssertionError"
+  AssertionError
+



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


D5961: copies: add test that makes both the merging csets dirty and run w/o error

2019-03-11 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGcbdd2b56d4c3: copies: add test that makes both the merging 
csets dirty and run w/o error (authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5961?vs=14346=14458

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

AFFECTED FILES
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -491,3 +491,64 @@
   $ hg debugpathcopies 0 5
   x -> z
 
+
+Test for a case in fullcopytracing algorithm where both the merging csets are
+"dirty"; where a dirty cset means that cset is descendant of merge base. This
+test reflect that for this particular case this algorithm correctly find the 
copies:
+
+  $ cat >> $HGRCPATH << EOF
+  > [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
+  > EOF
+
+  $ newrepo
+  $ echo a > a
+  $ hg add a
+  $ hg ci -m "added a"
+  $ echo b > b
+  $ hg add b
+  $ hg ci -m "added b"
+
+  $ hg mv b b1
+  $ hg ci -m "rename b to b1"
+
+  $ hg up ".^"
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo d > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ echo baba >> b
+  $ hg ci --amend -m "added d, modified b"
+
+  $ hg l --hidden
+  @  4 added d, modified b
+  |  b d
+  | x  3 added d
+  |/   d
+  | o  2 rename b to b1
+  |/   b b1
+  o  1 added b
+  |  b
+  o  0 added a
+ a
+
+Grafting revision 4 on top of revision 2, showing that it respect the rename:
+
+  $ hg up 2 -q
+  $ hg graft -r 4 --base 3 --hidden
+  grafting 4:af28412ec03c "added d, modified b" (tip)
+  merging b1 and b to b1
+
+  $ hg l -l1 -p
+  @  5 added d, modified b
+  |  b1
+  ~  diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1
+ --- a/b1  Thu Jan 01 00:00:00 1970 +
+ +++ b/b1  Thu Jan 01 00:00:00 1970 +
+ @@ -1,1 +1,2 @@
+  b
+ +baba
+  



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


D5962: copies: add test that makes both the merging csets dirty and fails

2019-03-11 Thread khanchi97 (Sushil khanchi)
khanchi97 marked 2 inline comments as done.
khanchi97 added a comment.


  Thanks, I have updated the patch.

REPOSITORY
  rHG Mercurial

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

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


D5963: copies: handle a case when both merging csets are not descendant of merge base

2019-03-11 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 14457.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5963?vs=14348=14457

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -554,8 +554,9 @@
   b
  +baba
   
-Test which demonstrate that fullcopytracing algorithm can fail to handle a 
case when both the csets are dirty
---
+Test to make sure that fullcopytracing algorithm don't fail when both the 
merging csets are dirty
+(a dirty cset is one who is not the descendant of merge base)
+-
 
   $ newrepo
   $ echo a > a
@@ -628,6 +629,5 @@
 Now if we trigger a merge between cset revision 3 and 6 using base revision 4, 
in this case
 both the merging csets will be dirty as no one is descendent of base revision:
 
-  $ hg graft -r 6 --base 4 --hidden 2>&1 | grep "AssertionError"
-  AssertionError
-
+  $ hg graft -r 6 --base 4 --hidden -t :other
+  grafting 6:99802e4f1e46 "added willconflict and d" (tip)
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -608,7 +608,7 @@
 if dirtyc1:
 _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge,
incompletediverge)
-else:
+if dirtyc2:
 _combinecopies(data1['incomplete'], data2['incomplete'], copy, diverge,
incompletediverge)
 
@@ -647,7 +647,13 @@
 for f in bothnew:
 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1)
 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2)
-if dirtyc1:
+if dirtyc1 and dirtyc2:
+remainder = _combinecopies(both2['incomplete'], both1['incomplete'],
+   copy, bothdiverge, bothincompletediverge)
+remainder1 = _combinecopies(both1['incomplete'], both2['incomplete'],
+   copy, bothdiverge, bothincompletediverge)
+remainder.update(remainder1)
+elif dirtyc1:
 # incomplete copies may only be found on the "dirty" side for bothnew
 assert not both2['incomplete']
 remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge,



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


D5962: copies: add test that makes both the merging csets dirty and fails

2019-03-11 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 14456.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5962?vs=14347=14456

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

AFFECTED FILES
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -1,6 +1,8 @@
 #testcases filelog compatibility
 
   $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > rebase=
   > [alias]
   > l = log -G -T '{rev} {desc}\n{files}\n'
   > EOF
@@ -552,3 +554,80 @@
   b
  +baba
   
+Test which demonstrate that fullcopytracing algorithm can fail to handle a 
case when both the csets are dirty
+--
+
+  $ newrepo
+  $ echo a > a
+  $ hg add a
+  $ hg ci -m "added a"
+  $ echo b > b
+  $ hg add b
+  $ hg ci -m "added b"
+
+  $ echo foobar > willconflict
+  $ hg add willconflict
+  $ hg ci -m "added willconflict"
+  $ echo c > c
+  $ hg add c
+  $ hg ci -m "added c"
+
+  $ hg l
+  @  3 added c
+  |  c
+  o  2 added willconflict
+  |  willconflict
+  o  1 added b
+  |  b
+  o  0 added a
+ a
+
+  $ hg up ".^^"
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo d > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ echo barfoo > willconflict
+  $ hg add willconflict
+  $ hg ci --amend -m "added willconflict and d"
+
+  $ hg l
+  @  5 added willconflict and d
+  |  d willconflict
+  | o  3 added c
+  | |  c
+  | o  2 added willconflict
+  |/   willconflict
+  o  1 added b
+  |  b
+  o  0 added a
+ a
+
+  $ hg rebase -r . -d 2 -t :other
+  rebasing 5:5018b1509e94 "added willconflict and d" (tip)
+
+  $ hg up 3 -q
+  $ hg l --hidden
+  o  6 added willconflict and d
+  |  d willconflict
+  | x  5 added willconflict and d
+  | |  d willconflict
+  | | x  4 added d
+  | |/   d
+  +---@  3 added c
+  | |c
+  o |  2 added willconflict
+  |/   willconflict
+  o  1 added b
+  |  b
+  o  0 added a
+ a
+
+Now if we trigger a merge between cset revision 3 and 6 using base revision 4, 
in this case
+both the merging csets will be dirty as no one is descendent of base revision:
+
+  $ hg graft -r 6 --base 4 --hidden 2>&1 | grep "AssertionError"
+  AssertionError
+



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


D5961: copies: add test that makes both the merging csets dirty and run w/o error

2019-03-09 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  Thanks

REPOSITORY
  rHG Mercurial

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

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


D5963: copies: handle a case when both merging csets are not descendant of merge base

2019-03-08 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  Gentle ping for review.

REPOSITORY
  rHG Mercurial

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

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


D5962: copies: add test that makes both the merging csets dirty and fails

2019-03-08 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  Ping for review.

REPOSITORY
  rHG Mercurial

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

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


D5961: copies: add test that makes both the merging csets dirty and run w/o error

2019-03-08 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  Ping for review.

REPOSITORY
  rHG Mercurial

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

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


D6058: patch: include flag-only file changes in "special" while filtering patch (issue5864)

2019-03-08 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  Ping for review.

REPOSITORY
  rHG Mercurial

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

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


D6057: split: add tests which demonstrate the issue5864

2019-03-08 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7da6307cc07a: split: add tests which demonstrate the 
issue5864 (authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6057?vs=14322=14413

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

AFFECTED FILES
  tests/test-split.t

CHANGE DETAILS

diff --git a/tests/test-split.t b/tests/test-split.t
--- a/tests/test-split.t
+++ b/tests/test-split.t
@@ -709,3 +709,45 @@
   EDITOR: HG: branch 'default'
   EDITOR: HG: changed foo
   saved backup bundle to 
$TESTTMP/f/b/.hg/strip-backup/904c80b40a4a-47fb907f-split.hg (obsstore-off !)
+
+
+Testing the case in split when commiting flag-only file changes (issue5864)
+---
+  $ hg init $TESTTMP/issue5864
+  $ cd $TESTTMP/issue5864
+  $ echo foo > foo
+  $ hg add foo
+  $ hg ci -m "initial"
+  $ chmod +x foo
+  $ hg ci -m "make executable"
+
+  $ hg glog
+  @  1:3a2125f0f4cb make executable
+  |
+  o  0:51f273a58d82 initial
+  
+
+  $ printf 'y\ny\ny\n' | hg split
+  diff --git a/foo b/foo
+  old mode 100644
+  new mode 100755
+  examine changes to 'foo'? [Ynesfdaq?] y
+  
+  no changes to record
+  diff --git a/foo b/foo
+  old mode 100644
+  new mode 100755
+  examine changes to 'foo'? [Ynesfdaq?] y
+  
+  no changes to record
+  diff --git a/foo b/foo
+  old mode 100644
+  new mode 100755
+  examine changes to 'foo'? [Ynesfdaq?] y
+  
+  no changes to record
+  diff --git a/foo b/foo
+  old mode 100644
+  new mode 100755
+  examine changes to 'foo'? [Ynesfdaq?] abort: response expected
+  [255]



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


D6057: split: add tests which demonstrate the issue5864

2019-03-08 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  Ping for review!

REPOSITORY
  rHG Mercurial

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

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


D5961: copies: add test that makes both the merging csets dirty and run w/o error

2019-03-04 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  I have updated the commit message too.

REPOSITORY
  rHG Mercurial

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

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


D5963: copies: handle a case when both merging csets are not descendant of merge base

2019-03-04 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 14348.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5963?vs=14310=14348

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -656,6 +656,29 @@
 Now if we trigger a merge between cset revision 3 and 6 using base revision 4, 
in this case
 both the merging csets will be dirty as no one is descendent of base revision:
 
-  $ hg graft -r 6 --base 4 --hidden 2>&1 | grep "AssertionError"
-  AssertionError
+  $ hg graft -r 6 --base 4 --hidden
+  grafting 6:99802e4f1e46 "added willconflict and d" (tip)
+  merging willconflict
+  warning: conflicts while merging willconflict! (edit, then use 'hg resolve 
--mark')
+  abort: unresolved conflicts, can't continue
+  (use 'hg resolve' and 'hg graft --continue')
+  [255]
 
+  $ hg diff
+  diff -r 9a8bb7cc6814 willconflict
+  --- a/willconflict   Thu Jan 01 00:00:00 1970 +
+  +++ b/willconflict   Thu Jan 01 00:00:00 1970 +
+  @@ -1,1 +1,5 @@
+  +<<< local: 9a8bb7cc6814 - test: added c
+   foobar
+  +===
+  +barfoo
+  +>>> graft: 99802e4f1e46 - test: added willconflict and d
+
+  $ echo barfoo > willconflict
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg graft --continue
+
+  $ hg graft --continue
+  grafting 6:99802e4f1e46 "added willconflict and d" (tip)
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -608,7 +608,7 @@
 if dirtyc1:
 _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge,
incompletediverge)
-else:
+if dirtyc2:
 _combinecopies(data1['incomplete'], data2['incomplete'], copy, diverge,
incompletediverge)
 
@@ -647,7 +647,13 @@
 for f in bothnew:
 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1)
 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2)
-if dirtyc1:
+if dirtyc1 and dirtyc2:
+remainder = _combinecopies(both2['incomplete'], both1['incomplete'],
+   copy, bothdiverge, bothincompletediverge)
+remainder1 = _combinecopies(both1['incomplete'], both2['incomplete'],
+   copy, bothdiverge, bothincompletediverge)
+remainder.update(remainder1)
+elif dirtyc1:
 # incomplete copies may only be found on the "dirty" side for bothnew
 assert not both2['incomplete']
 remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge,



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


D5962: copies: add test that makes both the merging csets dirty and fails

2019-03-04 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 14347.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5962?vs=14309=14347

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

AFFECTED FILES
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -1,6 +1,8 @@
 #testcases filelog compatibility
 
   $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > rebase=
   > [alias]
   > l = log -G -T '{rev} {desc}\n{files}\n'
   > EOF
@@ -552,3 +554,108 @@
   b
  +baba
   
+Test which demonstrate that fullcopytracing algorithm can fail to handle a 
case when both the csets are dirty
+--
+
+  $ newrepo
+  $ echo a > a
+  $ hg add a
+  $ hg ci -m "added a"
+  $ echo b > b
+  $ hg add b
+  $ hg ci -m "added b"
+
+  $ echo foobar > willconflict
+  $ hg add willconflict
+  $ hg ci -m "added willconflict"
+  $ echo c > c
+  $ hg add c
+  $ hg ci -m "added c"
+
+  $ hg log -G -T '{rev} : {node|short}   {desc} \n{phase}\n'
+  @  3 : 9a8bb7cc6814   added c
+  |  draft
+  o  2 : d2ea38baf44e   added willconflict
+  |  draft
+  o  1 : 5f6d8a4bf34a   added b
+  |  draft
+  o  0 : 9092f1db7931   added a
+ draft
+
+  $ hg up ".^^"
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo d > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ echo barfoo > willconflict
+  $ hg add willconflict
+  $ hg ci --amend -m "added willconflict and d"
+
+  $ hg l
+  @  5 added willconflict and d
+  |  d willconflict
+  | o  3 added c
+  | |  c
+  | o  2 added willconflict
+  |/   willconflict
+  o  1 added b
+  |  b
+  o  0 added a
+ a
+
+  $ hg rebase -r . -d 2
+  rebasing 5:5018b1509e94 "added willconflict and d" (tip)
+  merging willconflict
+  warning: conflicts while merging willconflict! (edit, then use 'hg resolve 
--mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+  $ hg diff
+  diff -r d2ea38baf44e d
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/d  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +d
+  diff -r d2ea38baf44e willconflict
+  --- a/willconflict   Thu Jan 01 00:00:00 1970 +
+  +++ b/willconflict   Thu Jan 01 00:00:00 1970 +
+  @@ -1,1 +1,5 @@
+  +<<< dest:   d2ea38baf44e - test: added willconflict
+   foobar
+  +===
+  +barfoo
+  +>>> source: 5018b1509e94 - test: added willconflict and d
+
+  $ echo barfoo > willconflict
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg rebase --continue
+  $ hg rebase --continue
+  rebasing 5:5018b1509e94 "added willconflict and d" (tip)
+
+  $ hg up 3 -q
+
+  $ hg l --hidden
+  o  6 added willconflict and d
+  |  d willconflict
+  | x  5 added willconflict and d
+  | |  d willconflict
+  | | x  4 added d
+  | |/   d
+  +---@  3 added c
+  | |c
+  o |  2 added willconflict
+  |/   willconflict
+  o  1 added b
+  |  b
+  o  0 added a
+ a
+
+Now if we trigger a merge between cset revision 3 and 6 using base revision 4, 
in this case
+both the merging csets will be dirty as no one is descendent of base revision:
+
+  $ hg graft -r 6 --base 4 --hidden 2>&1 | grep "AssertionError"
+  AssertionError
+



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


D5961: copies: add test that makes both the merging csets dirty and run w/o error

2019-03-04 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 14346.
khanchi97 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5961?vs=14308=14346

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

AFFECTED FILES
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -491,3 +491,64 @@
   $ hg debugpathcopies 0 5
   x -> z
 
+
+Test for a case in fullcopytracing algorithm where both the merging csets are
+"dirty"; where a dirty cset means that cset is descendant of merge base. This
+test reflect that for this particular case this algorithm correctly find the 
copies:
+
+  $ cat >> $HGRCPATH << EOF
+  > [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
+  > EOF
+
+  $ newrepo
+  $ echo a > a
+  $ hg add a
+  $ hg ci -m "added a"
+  $ echo b > b
+  $ hg add b
+  $ hg ci -m "added b"
+
+  $ hg mv b b1
+  $ hg ci -m "rename b to b1"
+
+  $ hg up ".^"
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo d > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ echo baba >> b
+  $ hg ci --amend -m "added d, modified b"
+
+  $ hg l --hidden
+  @  4 added d, modified b
+  |  b d
+  | x  3 added d
+  |/   d
+  | o  2 rename b to b1
+  |/   b b1
+  o  1 added b
+  |  b
+  o  0 added a
+ a
+
+Grafting revision 4 on top of revision 2, showing that it respect the rename:
+
+  $ hg up 2 -q
+  $ hg graft -r 4 --base 3 --hidden
+  grafting 4:af28412ec03c "added d, modified b" (tip)
+  merging b1 and b to b1
+
+  $ hg l -l1 -p
+  @  5 added d, modified b
+  |  b1
+  ~  diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1
+ --- a/b1  Thu Jan 01 00:00:00 1970 +
+ +++ b/b1  Thu Jan 01 00:00:00 1970 +
+ @@ -1,1 +1,2 @@
+  b
+ +baba
+  



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


D5961: copies: add test that makes both the merging csets dirty and run w/o error

2019-03-04 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  Updating it acc to your suggestions.

INLINE COMMENTS

> martinvonz wrote in test-copies.t:495-497
> I don't follow this. What does "dirty" mean here? We normally mean that there 
> are changes in the working copy when we say dirty, but that's clearly not 
> what you mean here. The commit message is similarly confusing to me.

In this algorithms we call a merging cset "dirty" if it is not a descendant of 
merge base. And this test cover the case when both the csets are "dirty".

REPOSITORY
  rHG Mercurial

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

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


D6058: patch: include flag-only file changes in "special" while filtering patch (issue5864)

2019-03-03 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch fix the issue5864 (or maybe issue5865 too) which occurs during
  split (or I should say at the time of filtering the hunks in interactive
  mode) where user hits a not ending loop of "no changes to record".
  And it's not only the case for split it will happen in every interactive
  case for e.g. `hg commit -i` or `hg uncommit -i`
  
  After looking into code I found that when filtering we have some
  notation called "special" for the file headers which doesn't contain
  any hunk and just contain the header (for e.g. newly added empty file
  or deleted file) where the user cannot change the content of operation.
  
  And I think we can put this "flag-only" file change in that same bucket
  of "special". But I doubt a bit about the case when a file have flag change
  and atleast one hunk then user won't be able to separate the flag change
  from hunks.
  Changed test file reflect the fixed behaviour.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/patch.py
  tests/test-split.t

CHANGE DETAILS

diff --git a/tests/test-split.t b/tests/test-split.t
--- a/tests/test-split.t
+++ b/tests/test-split.t
@@ -727,27 +727,57 @@
   o  0:51f273a58d82 initial
   
 
-  $ printf 'y\ny\ny\n' | hg split
-  diff --git a/foo b/foo
-  old mode 100644
-  new mode 100755
-  examine changes to 'foo'? [Ynesfdaq?] y
-  
-  no changes to record
+  $ cat > $TESTTMP/messages < split 1
+  > EOF
+
+#if obsstore-on
+  $ printf 'y\n' | hg split
   diff --git a/foo b/foo
   old mode 100644
   new mode 100755
   examine changes to 'foo'? [Ynesfdaq?] y
   
-  no changes to record
+  EDITOR: HG: Splitting 3a2125f0f4cb. Write commit message for the first split 
changeset.
+  EDITOR: make executable
+  EDITOR: 
+  EDITOR: 
+  EDITOR: HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+  EDITOR: HG: Leave message empty to abort commit.
+  EDITOR: HG: --
+  EDITOR: HG: user: test
+  EDITOR: HG: branch 'default'
+  EDITOR: HG: changed foo
+  created new head
+
+  $ hg glog
+  @  2:b154670c87da split 1
+  |
+  o  0:51f273a58d82 initial
+  
+#else
+  $ printf 'y\n' | hg split
   diff --git a/foo b/foo
   old mode 100644
   new mode 100755
   examine changes to 'foo'? [Ynesfdaq?] y
   
-  no changes to record
-  diff --git a/foo b/foo
-  old mode 100644
-  new mode 100755
-  examine changes to 'foo'? [Ynesfdaq?] abort: response expected
-  [255]
+  EDITOR: HG: Splitting 3a2125f0f4cb. Write commit message for the first split 
changeset.
+  EDITOR: make executable
+  EDITOR: 
+  EDITOR: 
+  EDITOR: HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+  EDITOR: HG: Leave message empty to abort commit.
+  EDITOR: HG: --
+  EDITOR: HG: user: test
+  EDITOR: HG: branch 'default'
+  EDITOR: HG: changed foo
+  created new head
+  saved backup bundle to 
$TESTTMP/issue5864/.hg/strip-backup/3a2125f0f4cb-629e4432-split.hg
+
+  $ hg glog
+  @  1:b154670c87da split 1
+  |
+  o  0:51f273a58d82 initial
+  
+#endif
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -863,7 +863,7 @@
 diff_re = re.compile('diff -r .* (.*)$')
 allhunks_re = re.compile('(?:index|deleted file) ')
 pretty_re = re.compile('(?:new file|deleted file) ')
-special_re = re.compile('(?:index|deleted|copy|rename) ')
+special_re = re.compile('(?:index|deleted|copy|rename|new mode) ')
 newfile_re = re.compile('(?:new file)')
 
 def __init__(self, header):



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


D6057: split: add tests which demonstrate the issue5864

2019-03-03 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-split.t

CHANGE DETAILS

diff --git a/tests/test-split.t b/tests/test-split.t
--- a/tests/test-split.t
+++ b/tests/test-split.t
@@ -709,3 +709,45 @@
   EDITOR: HG: branch 'default'
   EDITOR: HG: changed foo
   saved backup bundle to 
$TESTTMP/f/b/.hg/strip-backup/904c80b40a4a-47fb907f-split.hg (obsstore-off !)
+
+
+Testing the case in split when commiting flag-only file changes (issue5864)
+---
+  $ hg init $TESTTMP/issue5864
+  $ cd $TESTTMP/issue5864
+  $ echo foo > foo
+  $ hg add foo
+  $ hg ci -m "initial"
+  $ chmod +x foo
+  $ hg ci -m "make executable"
+
+  $ hg glog
+  @  1:3a2125f0f4cb make executable
+  |
+  o  0:51f273a58d82 initial
+  
+
+  $ printf 'y\ny\ny\n' | hg split
+  diff --git a/foo b/foo
+  old mode 100644
+  new mode 100755
+  examine changes to 'foo'? [Ynesfdaq?] y
+  
+  no changes to record
+  diff --git a/foo b/foo
+  old mode 100644
+  new mode 100755
+  examine changes to 'foo'? [Ynesfdaq?] y
+  
+  no changes to record
+  diff --git a/foo b/foo
+  old mode 100644
+  new mode 100755
+  examine changes to 'foo'? [Ynesfdaq?] y
+  
+  no changes to record
+  diff --git a/foo b/foo
+  old mode 100644
+  new mode 100755
+  examine changes to 'foo'? [Ynesfdaq?] abort: response expected
+  [255]



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


D5961: copies: add test that makes both the merging csets dirty and run w/o error

2019-03-02 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In https://phab.mercurial-scm.org/D5961#88217, @martinvonz wrote:
  
  > From `test-check-code.t`:
  >
  >   @@ -15,6 +15,13 @@
  >  Skipping i18n/polib.py it has no-che?k-code (glob)
  >  Skipping mercurial/statprof.py it has no-che?k-code (glob)
  >  Skipping tests/badserverext.py it has no-che?k-code (glob)
  >   +  tests/test-copies.t:515:
  >   +   >
  >   +   trailing whitespace on non-output
  >   +  tests/test-copies.t:516:
  >   +   >   $ hg up .^
  >   +   warning: ^ must be quoted
  >   +  [1]
  >  
  >@commands in debugcommands.py should be in alphabetical order.
  >
  
  
  So test-check-code.t checks test files too. I wasn't aware of that and didn't 
run tests on the patches which adds tests only. I have updated the revisions 
now :)

REPOSITORY
  rHG Mercurial

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

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


D5963: copies: handle a case when both merging csets are not descendant of merge base

2019-03-02 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 14310.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5963?vs=14241=14310

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -701,6 +701,29 @@
 Now if we trigger a merge between cset revision 3 and 6 using base revision 4, 
in this case
 both the merging csets will be dirty as no one is descendent of base revision:
 
-  $ hg graft -r 6 --base c9241b0f2d5b --hidden 2>&1 | grep "AssertionError"
-  AssertionError
+  $ hg graft -r 6 --base c9241b0f2d5b --hidden
+  grafting 6:99802e4f1e46 "added willconflict and d" (tip)
+  merging willconflict
+  warning: conflicts while merging willconflict! (edit, then use 'hg resolve 
--mark')
+  abort: unresolved conflicts, can't continue
+  (use 'hg resolve' and 'hg graft --continue')
+  [255]
 
+  $ hg diff
+  diff -r 9a8bb7cc6814 willconflict
+  --- a/willconflict   Thu Jan 01 00:00:00 1970 +
+  +++ b/willconflict   Thu Jan 01 00:00:00 1970 +
+  @@ -1,1 +1,5 @@
+  +<<< local: 9a8bb7cc6814 - test: added c
+   foobar
+  +===
+  +barfoo
+  +>>> graft: 99802e4f1e46 - test: added willconflict and d
+
+  $ echo barfoo > willconflict
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg graft --continue
+
+  $ hg graft --continue
+  grafting 6:99802e4f1e46 "added willconflict and d" (tip)
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -608,7 +608,7 @@
 if dirtyc1:
 _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge,
incompletediverge)
-else:
+if dirtyc2:
 _combinecopies(data1['incomplete'], data2['incomplete'], copy, diverge,
incompletediverge)
 
@@ -647,7 +647,13 @@
 for f in bothnew:
 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1)
 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2)
-if dirtyc1:
+if dirtyc1 and dirtyc2:
+remainder = _combinecopies(both2['incomplete'], both1['incomplete'],
+   copy, bothdiverge, bothincompletediverge)
+remainder1 = _combinecopies(both1['incomplete'], both2['incomplete'],
+   copy, bothdiverge, bothincompletediverge)
+remainder.update(remainder1)
+elif dirtyc1:
 # incomplete copies may only be found on the "dirty" side for bothnew
 assert not both2['incomplete']
 remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge,



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


D5962: copies: add test that makes both the merging csets dirty and fails

2019-03-02 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 14309.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5962?vs=14240=14309

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

AFFECTED FILES
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -1,6 +1,8 @@
 #testcases filelog compatibility
 
   $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > rebase=
   > [alias]
   > l = log -G -T '{rev} {desc}\n{files}\n'
   > EOF
@@ -597,3 +599,108 @@
  +baba
   
 
+Test which demonstrate that fullcopytracing algorithm can fail to handle a 
case when both the csets are dirty
+--
+
+  $ newrepo
+  $ echo a > a
+  $ hg add a
+  $ hg ci -m "added a"
+  $ echo b > b
+  $ hg add b
+  $ hg ci -m "added b"
+
+  $ echo foobar > willconflict
+  $ hg add willconflict
+  $ hg ci -m "added willconflict"
+  $ echo c > c
+  $ hg add c
+  $ hg ci -m "added c"
+
+  $ hg log -G -T '{rev} : {node|short}   {desc} \n{phase}\n'
+  @  3 : 9a8bb7cc6814   added c
+  |  draft
+  o  2 : d2ea38baf44e   added willconflict
+  |  draft
+  o  1 : 5f6d8a4bf34a   added b
+  |  draft
+  o  0 : 9092f1db7931   added a
+ draft
+
+  $ hg up ".^^"
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo d > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ echo barfoo > willconflict
+  $ hg add willconflict
+  $ hg ci --amend -m "added willconflict and d"
+
+  $ hg log -G -T '{rev} : {node|short}   {desc} \n{phase}\n'
+  @  5 : 5018b1509e94   added willconflict and d
+  |  draft
+  | o  3 : 9a8bb7cc6814   added c
+  | |  draft
+  | o  2 : d2ea38baf44e   added willconflict
+  |/   draft
+  o  1 : 5f6d8a4bf34a   added b
+  |  draft
+  o  0 : 9092f1db7931   added a
+ draft
+
+  $ hg rebase -r . -d 2
+  rebasing 5:5018b1509e94 "added willconflict and d" (tip)
+  merging willconflict
+  warning: conflicts while merging willconflict! (edit, then use 'hg resolve 
--mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+  $ hg diff
+  diff -r d2ea38baf44e d
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/d  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +d
+  diff -r d2ea38baf44e willconflict
+  --- a/willconflict   Thu Jan 01 00:00:00 1970 +
+  +++ b/willconflict   Thu Jan 01 00:00:00 1970 +
+  @@ -1,1 +1,5 @@
+  +<<< dest:   d2ea38baf44e - test: added willconflict
+   foobar
+  +===
+  +barfoo
+  +>>> source: 5018b1509e94 - test: added willconflict and d
+
+  $ echo barfoo > willconflict
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg rebase --continue
+  $ hg rebase --continue
+  rebasing 5:5018b1509e94 "added willconflict and d" (tip)
+
+  $ hg up 3 -q
+
+  $ hg log -G --hidden -T '{rev} : {node|short}   {desc} \n{phase}\n'
+  o  6 : 99802e4f1e46   added willconflict and d
+  |  draft
+  | x  5 : 5018b1509e94   added willconflict and d
+  | |  draft
+  | | x  4 : c9241b0f2d5b   added d
+  | |/   draft
+  +---@  3 : 9a8bb7cc6814   added c
+  | |draft
+  o |  2 : d2ea38baf44e   added willconflict
+  |/   draft
+  o  1 : 5f6d8a4bf34a   added b
+  |  draft
+  o  0 : 9092f1db7931   added a
+ draft
+
+Now if we trigger a merge between cset revision 3 and 6 using base revision 4, 
in this case
+both the merging csets will be dirty as no one is descendent of base revision:
+
+  $ hg graft -r 6 --base c9241b0f2d5b --hidden 2>&1 | grep "AssertionError"
+  AssertionError
+



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


D5961: copies: add test that makes both the merging csets dirty and run w/o error

2019-03-02 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 14308.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5961?vs=14239=14308

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

AFFECTED FILES
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -491,3 +491,109 @@
   $ hg debugpathcopies 0 5
   x -> z
 
+
+Test for a case in fullcopytracing algorithm where both the merging csets are
+dirty which means no cset is descendant of merging base. This test reflect
+that for this particular case this algorithm correctly find the copies:
+
+  $ cat >> $HGRCPATH << EOF
+  > [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
+  > EOF
+
+  $ newrepo
+  $ echo a > a
+  $ hg add a
+  $ hg ci -m "added a"
+  $ echo b > b
+  $ hg add b
+  $ hg ci -m "added b"
+
+  $ hg mv b b1
+  $ hg ci -m "rename b to b1"
+
+  $ hg up ".^"
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo d > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ echo baba >> b
+  $ hg ci --amend -m "added d"
+
+  $ hg log --git -pG --hidden -T "{rev}: {node|short} {desc}\n {phase} \n\n"
+  @  4: d70f3e12cfd9 added d
+  |   draft
+  |
+  |  diff --git a/b b/b
+  |  --- a/b
+  |  +++ b/b
+  |  @@ -1,1 +1,2 @@
+  |   b
+  |  +baba
+  |  diff --git a/d b/d
+  |  new file mode 100644
+  |  --- /dev/null
+  |  +++ b/d
+  |  @@ -0,0 +1,1 @@
+  |  +d
+  |
+  | x  3: c9241b0f2d5b added d
+  |/draft
+  |
+  |diff --git a/d b/d
+  |new file mode 100644
+  |--- /dev/null
+  |+++ b/d
+  |@@ -0,0 +1,1 @@
+  |+d
+  |
+  | o  2: 5a4825cc2926 rename b to b1
+  |/draft
+  |
+  |diff --git a/b b/b1
+  |rename from b
+  |rename to b1
+  |
+  o  1: 5f6d8a4bf34a added b
+  |   draft
+  |
+  |  diff --git a/b b/b
+  |  new file mode 100644
+  |  --- /dev/null
+  |  +++ b/b
+  |  @@ -0,0 +1,1 @@
+  |  +b
+  |
+  o  0: 9092f1db7931 added a
+  draft
+  
+ diff --git a/a b/a
+ new file mode 100644
+ --- /dev/null
+ +++ b/a
+ @@ -0,0 +1,1 @@
+ +a
+  
+
+Grafting revision 4 on top of revision 2, showing that it respect the rename:
+
+  $ hg up 2 -q
+  $ hg graft -r 4 --base c9241b0f2d5b --hidden
+  grafting 4:d70f3e12cfd9 "added d" (tip)
+  merging b1 and b to b1
+
+  $ hg log --git -pG -l 1 -T "{rev}: {node|short} {desc}\n {phase} \n\n"
+  @  5: 54ee32fbd09a added d
+  |   draft
+  ~
+ diff --git a/b1 b/b1
+ --- a/b1
+ +++ b/b1
+ @@ -1,1 +1,2 @@
+  b
+ +baba
+  
+



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


  1   2   3   4   >