D1616: rebase: disable `inmemory` if the rebaseset contains the working copy

2017-12-08 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG03bec089e105: rebase: disable `inmemory` if the rebaseset 
contains the working copy (authored by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1616?vs=4276&id=4285

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -830,7 +830,8 @@
 else:
 destmap = _definedestmap(ui, repo, destf, srcf, basef, revf,
  destspace=destspace,
- inmemory=opts['inmemory'])
+ opts=opts)
+rbsrt.inmemory = opts['inmemory']
 retcode = rbsrt._preparenewrebase(destmap)
 if retcode is not None:
 return retcode
@@ -850,7 +851,7 @@
 rbsrt._finishrebase()
 
 def _definedestmap(ui, repo, destf=None, srcf=None, basef=None, revf=None,
-   destspace=None, inmemory=False):
+   destspace=None, opts=None):
 """use revisions argument to define destmap {srcrev: destrev}"""
 if revf is None:
 revf = []
@@ -864,7 +865,7 @@
 if revf and srcf:
 raise error.Abort(_('cannot specify both a revision and a source'))
 
-if not inmemory:
+if not opts['inmemory']:
 cmdutil.checkunfinished(repo)
 cmdutil.bailifchanged(repo)
 
@@ -939,6 +940,22 @@
 ui.status(_('nothing to rebase from %s to %s\n') %
   ('+'.join(str(repo[r]) for r in base), dest))
 return None
+# If rebasing the working copy parent, force in-memory merge to be off.
+#
+# This is because the extra work of checking out the newly rebased commit
+# outweights the benefits of rebasing in-memory, and executing an extra
+# update command adds a bit of overhead, so better to just do it on disk. 
In
+# all other cases leave it on.
+#
+# Note that there are cases where this isn't true -- e.g., rebasing large
+# stacks that include the WCP. However, I'm not yet sure where the cutoff
+# is.
+rebasingwcp = repo['.'].rev() in rebaseset
+if opts['inmemory'] and rebasingwcp:
+opts['inmemory'] = False
+# Check these since we did not before.
+cmdutil.checkunfinished(repo)
+cmdutil.bailifchanged(repo)
 
 if not destf:
 dest = repo[_destrebase(repo, rebaseset, destspace=destspace)]



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


D1616: rebase: disable `inmemory` if the rebaseset contains the working copy

2017-12-08 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 4276.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1616?vs=4247&id=4276

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -830,7 +830,8 @@
 else:
 destmap = _definedestmap(ui, repo, destf, srcf, basef, revf,
  destspace=destspace,
- inmemory=opts['inmemory'])
+ opts=opts)
+rbsrt.inmemory = opts['inmemory']
 retcode = rbsrt._preparenewrebase(destmap)
 if retcode is not None:
 return retcode
@@ -850,7 +851,7 @@
 rbsrt._finishrebase()
 
 def _definedestmap(ui, repo, destf=None, srcf=None, basef=None, revf=None,
-   destspace=None, inmemory=False):
+   destspace=None, opts=None):
 """use revisions argument to define destmap {srcrev: destrev}"""
 if revf is None:
 revf = []
@@ -864,7 +865,7 @@
 if revf and srcf:
 raise error.Abort(_('cannot specify both a revision and a source'))
 
-if not inmemory:
+if not opts['inmemory']:
 cmdutil.checkunfinished(repo)
 cmdutil.bailifchanged(repo)
 
@@ -939,6 +940,22 @@
 ui.status(_('nothing to rebase from %s to %s\n') %
   ('+'.join(str(repo[r]) for r in base), dest))
 return None
+# If rebasing the working copy parent, force in-memory merge to be off.
+#
+# This is because the extra work of checking out the newly rebased commit
+# outweights the benefits of rebasing in-memory, and executing an extra
+# update command adds a bit of overhead, so better to just do it on disk. 
In
+# all other cases leave it on.
+#
+# Note that there are cases where this isn't true -- e.g., rebasing large
+# stacks that include the WCP. However, I'm not yet sure where the cutoff
+# is.
+rebasingwcp = repo['.'].rev() in rebaseset
+if opts['inmemory'] and rebasingwcp:
+opts['inmemory'] = False
+# Check these since we did not before.
+cmdutil.checkunfinished(repo)
+cmdutil.bailifchanged(repo)
 
 if not destf:
 dest = repo[_destrebase(repo, rebaseset, destspace=destspace)]



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


D1616: rebase: disable `inmemory` if the rebaseset contains the working copy

2017-12-08 Thread phillco (Phil Cohen)
phillco added a comment.


  @dlax you mean the parts where we pass `opts` instead of `inmemory`? This is 
necessary for the function to mutate `opts['inmemory']`.

REPOSITORY
  rHG Mercurial

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

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


D1616: rebase: disable `inmemory` if the rebaseset contains the working copy

2017-12-08 Thread dlax (Denis Laxalde)
dlax added a comment.


  In https://phab.mercurial-scm.org/D1616#27819, @durin42 wrote:
  
  > @dlax I see a request changes here, but I don't see any commentary as to 
why?
  
  
  I meant to comment that the first hunks (i.e.  those above the big comment 
block) seem unrelated and to ask for clarification.
  No idea where my comment went, sorry...

REPOSITORY
  rHG Mercurial

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

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


D1616: rebase: disable `inmemory` if the rebaseset contains the working copy

2017-12-08 Thread durin42 (Augie Fackler)
durin42 added a comment.


  @dlax I see a request changes here, but I don't see any commentary as to why?

REPOSITORY
  rHG Mercurial

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

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


D1616: rebase: disable `inmemory` if the rebaseset contains the working copy

2017-12-07 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 4247.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1616?vs=4242&id=4247

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -179,7 +179,6 @@
 self.keepopen = opts.get('keepopen', False)
 self.obsoletenotrebased = {}
 self.obsoletewithoutsuccessorindestination = set()
-self.inmemory = opts.get('inmemory', False)
 
 @property
 def repo(self):
@@ -830,7 +829,8 @@
 else:
 destmap = _definedestmap(ui, repo, destf, srcf, basef, revf,
  destspace=destspace,
- inmemory=opts['inmemory'])
+ opts=opts)
+rbsrt.inmemory = opts['inmemory']
 retcode = rbsrt._preparenewrebase(destmap)
 if retcode is not None:
 return retcode
@@ -850,7 +850,7 @@
 rbsrt._finishrebase()
 
 def _definedestmap(ui, repo, destf=None, srcf=None, basef=None, revf=None,
-   destspace=None, inmemory=False):
+   destspace=None, opts=None):
 """use revisions argument to define destmap {srcrev: destrev}"""
 if revf is None:
 revf = []
@@ -864,7 +864,7 @@
 if revf and srcf:
 raise error.Abort(_('cannot specify both a revision and a source'))
 
-if not inmemory:
+if not opts['inmemory']:
 cmdutil.checkunfinished(repo)
 cmdutil.bailifchanged(repo)
 
@@ -939,6 +939,22 @@
 ui.status(_('nothing to rebase from %s to %s\n') %
   ('+'.join(str(repo[r]) for r in base), dest))
 return None
+# If rebasing the working copy parent, force in-memory merge to be off.
+#
+# This is because the extra work of checking out the newly rebased commit
+# outweights the benefits of rebasing in-memory, and executing an extra
+# update command adds a bit of overhead, so better to just do it on disk. 
In
+# all other cases leave it on.
+#
+# Note that there are cases where this isn't true -- e.g., rebasing large
+# stacks that include the WCP. However, I'm not yet sure where the cutoff
+# is.
+rebasingwcp = repo['.'].rev() in rebaseset
+if opts['inmemory'] and rebasingwcp:
+opts['inmemory'] = False
+# Check these since we did not before.
+cmdutil.checkunfinished(repo)
+cmdutil.bailifchanged(repo)
 
 if not destf:
 dest = repo[_destrebase(repo, rebaseset, destspace=destspace)]



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


D1616: rebase: disable `inmemory` if the rebaseset contains the working copy

2017-12-07 Thread phillco (Phil Cohen)
phillco created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As described in the comment, rebasing the working copy parent with in-memory
  merge, and then updating to the new commit, isn't much faster because of the
  extra overhead of uppdating. Best to leavew it off in that case.
  
  This commit makes deploying in-memory merge via an extension easier, because
  you can just set `inmemory=True` based on some config or probability, and this
  will turn off the cases where it's not desired.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -179,7 +179,6 @@
 self.keepopen = opts.get('keepopen', False)
 self.obsoletenotrebased = {}
 self.obsoletewithoutsuccessorindestination = set()
-self.inmemory = opts.get('inmemory', False)
 
 @property
 def repo(self):
@@ -830,7 +829,8 @@
 else:
 destmap = _definedestmap(ui, repo, destf, srcf, basef, revf,
  destspace=destspace,
- inmemory=opts['inmemory'])
+ opts=opts)
+rbsrt.inmemory = opts['inmemory']
 retcode = rbsrt._preparenewrebase(destmap)
 if retcode is not None:
 return retcode
@@ -850,7 +850,7 @@
 rbsrt._finishrebase()
 
 def _definedestmap(ui, repo, destf=None, srcf=None, basef=None, revf=None,
-   destspace=None, inmemory=False):
+   destspace=None, opts=None):
 """use revisions argument to define destmap {srcrev: destrev}"""
 if revf is None:
 revf = []
@@ -864,7 +864,7 @@
 if revf and srcf:
 raise error.Abort(_('cannot specify both a revision and a source'))
 
-if not inmemory:
+if not opts['inmemory']:
 cmdutil.checkunfinished(repo)
 cmdutil.bailifchanged(repo)
 
@@ -939,6 +939,22 @@
 ui.status(_('nothing to rebase from %s to %s\n') %
   ('+'.join(str(repo[r]) for r in base), dest))
 return None
+# If rebasing the working copy parent, force in-memory merge to be off.
+#
+# This is because the extra work of checking out the newly rebased commit
+# outweights the benefits of rebasing in-memory, and executing an extra
+# update command adds a bit of overhead, so better to just do it on disk. 
In
+# all other cases leave it on.
+#
+# Note that there are cases where this isn't true -- e.g., rebasing large
+# stacks that include the WCP. However, I'm not yet sure where the cutoff
+# is.
+rebasingwcp = repo['.'].rev() in rebaseset
+if opts['inmemory'] and rebasingwcp:
+opts['inmemory'] = False
+# Check these since we did not before.
+cmdutil.checkunfinished(repo)
+cmdutil.bailifchanged(repo)
 
 if not destf:
 dest = repo[_destrebase(repo, rebaseset, destspace=destspace)]



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