D10391: outgoing: accept multiple destinations

2021-04-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This align the behavior of `hg outgoing` with the one of `hg incoming`. In 
addition this prepare the introduction of having simple `path` resolve to 
multiple destination in practice (eg: `default`)

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/hg.py
  tests/test-exchange-multi-source.t

CHANGE DETAILS

diff --git a/tests/test-exchange-multi-source.t 
b/tests/test-exchange-multi-source.t
--- a/tests/test-exchange-multi-source.t
+++ b/tests/test-exchange-multi-source.t
@@ -130,6 +130,46 @@
   $ cp -R ./branch-E ./branch-E-push
   $ cp -R ./branch-G ./branch-G-push
   $ cp -R ./branch-H ./branch-H-push
+  $ hg out -G -R test-repo-bare ./branch-E-push ./branch-G-push ./branch-H-push
+  comparing with ./branch-E-push
+  searching for changes
+  comparing with ./branch-G-push
+  searching for changes
+  comparing with ./branch-H-push
+  searching for changes
+  o  changeset:   7:40faebb2ec45
+  |  tag: tip
+  |  parent:  2:f838bfaca5c7
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: H
+  |
+  | o  changeset:   6:c521a06b234b
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: G
+  | |
+  | o  changeset:   5:2f3a4c5c1417
+  |parent:  1:27547f69f254
+  |user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |summary: F
+  |
+  | o  changeset:   4:a603bfb5a83e
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: E
+  | |
+  | o  changeset:   3:b3325c91a4d9
+  |/   user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |summary: D
+  |
+  o  changeset:   2:f838bfaca5c7
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: C
+  
   $ hg push --force -R test-repo-bare ./branch-E-push ./branch-G-push 
./branch-H-push
   pushing to ./branch-E-push
   searching for changes
@@ -291,6 +331,26 @@
   $ cp -R ./branch-E ./branch-E-push
   $ cp -R ./branch-G ./branch-G-push
   $ cp -R ./branch-H ./branch-H-push
+  $ hg out -G -R test-repo-bare ./branch-E-push ./branch-G-push 
./branch-H-push --rev default
+  comparing with ./branch-E-push
+  searching for changes
+  comparing with ./branch-G-push
+  searching for changes
+  comparing with ./branch-H-push
+  searching for changes
+  no changes found
+  o  changeset:   7:40faebb2ec45
+  |  tag: tip
+  |  parent:  2:f838bfaca5c7
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: H
+  |
+  o  changeset:   2:f838bfaca5c7
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: C
+  
   $ hg push --force -R test-repo-bare ./branch-E-push ./branch-G-push 
./branch-H-push --rev default
   pushing to ./branch-E-push
   searching for changes
@@ -349,6 +409,26 @@
   $ cp -R ./branch-E ./branch-E-push
   $ cp -R ./branch-G ./branch-G-push
   $ cp -R ./branch-H ./branch-H-push
+  $ hg out -G -R test-repo-bare ./branch-G-push ./branch-H-push 
./branch-E-push --rev default
+  comparing with ./branch-G-push
+  searching for changes
+  comparing with ./branch-H-push
+  searching for changes
+  no changes found
+  comparing with ./branch-E-push
+  searching for changes
+  o  changeset:   7:40faebb2ec45
+  |  tag: tip
+  |  parent:  2:f838bfaca5c7
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: H
+  |
+  o  changeset:   2:f838bfaca5c7
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: C
+  
   $ hg push --force -R test-repo-bare ./branch-G-push ./branch-H-push 
./branch-E-push --rev default
   pushing to ./branch-G-push
   searching for changes
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1320,51 +1320,53 @@
 return _incoming(display, subreporecurse, ui, repo, source, opts)
 
 
-def _outgoing(ui, repo, dest, opts, subpath=None):
-path = ui.getpath(dest, default=(b'default-push', b'default'))
-if not path:
-raise error.Abort(
-_(b'default repository not configured!'),
-hint=_(b"see 'hg help config.paths'"),
-)
-dest = path.pushloc or path.loc
-if subpath is not None:
-subpath = urlutil.url(subpath)
-if subpath.isabs():
-dest = bytes(subpath)
-else:
-p = urlutil.url(dest)
-p.path = os.path.normpath(b'%s/%s' % (p.path, subpath))
-dest = bytes(p)
+def _outgoing(ui, repo, dests, opts, subpath=None):
+out = set()
+others = []
+for path in urlutil.get_push_paths(repo, ui, dests):
+dest = path.pushloc or path.loc
+if 

D10390: outgoing: pass subrepo path using function argument instead of abssource hack

2021-04-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is clearer, remove the needs for the `repo._subtoppath` hack and will 
make
  our live easier when making `outgoing` accept multiple destinations.
  
  We needed a new function to compute the appropriate "relative" location.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/hg.py
  mercurial/subrepo.py
  mercurial/subrepoutil.py

CHANGE DETAILS

diff --git a/mercurial/subrepoutil.py b/mercurial/subrepoutil.py
--- a/mercurial/subrepoutil.py
+++ b/mercurial/subrepoutil.py
@@ -383,6 +383,24 @@
 return subs, commitsubs, newstate
 
 
+def repo_rel_or_abs_source(repo):
+"""return the source of this repo
+
+Either absolute or relative the outermost repo"""
+parent = repo
+chunks = []
+while util.safehasattr(parent, b'_subparent'):
+source = urlutil.url(parent._subsource)
+chunks.append(bytes(source))
+if source.isabs():
+break
+parent = parent._subparent
+
+chunks.reverse()
+path = posixpath.join(*chunks)
+return posixpath.normpath(path)
+
+
 def reporelpath(repo):
 # type: (localrepo.localrepository) -> bytes
 """return path to this (sub)repo as seen from outermost repo"""
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -873,7 +873,8 @@
 opts = copy.copy(opts)
 opts.pop(b'rev', None)
 opts.pop(b'branch', None)
-return hg.outgoing(ui, self._repo, _abssource(self._repo, True), opts)
+subpath = subrepoutil.repo_rel_or_abs_source(self._repo)
+return hg.outgoing(ui, self._repo, dest, opts, subpath=subpath)
 
 @annotatesubrepoerror
 def incoming(self, ui, source, opts):
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1320,7 +1320,7 @@
 return _incoming(display, subreporecurse, ui, repo, source, opts)
 
 
-def _outgoing(ui, repo, dest, opts):
+def _outgoing(ui, repo, dest, opts, subpath=None):
 path = ui.getpath(dest, default=(b'default-push', b'default'))
 if not path:
 raise error.Abort(
@@ -1328,6 +1328,15 @@
 hint=_(b"see 'hg help config.paths'"),
 )
 dest = path.pushloc or path.loc
+if subpath is not None:
+subpath = urlutil.url(subpath)
+if subpath.isabs():
+dest = bytes(subpath)
+else:
+p = urlutil.url(dest)
+p.path = os.path.normpath(b'%s/%s' % (p.path, subpath))
+dest = bytes(p)
+
 branches = path.branch, opts.get(b'branch') or []
 
 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(dest))
@@ -1382,10 +1391,10 @@
 yield n
 
 
-def outgoing(ui, repo, dest, opts):
+def outgoing(ui, repo, dest, opts, subpath=None):
 if opts.get(b'graph'):
 logcmdutil.checkunsupportedgraphflags([], opts)
-o, other = _outgoing(ui, repo, dest, opts)
+o, other = _outgoing(ui, repo, dest, opts, subpath=subpath)
 ret = 1
 try:
 if o:
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4984,11 +4984,7 @@
 finally:
 other.close()
 
-repo._subtoppath = path.pushloc or path.loc
-try:
-return hg.outgoing(ui, repo, dest, opts)
-finally:
-del repo._subtoppath
+return hg.outgoing(ui, repo, dest, opts)
 
 
 @command(



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


D10388: split: fix issue with empty splits adjusting phases

2021-04-13 Thread spectral (Kyle Lippincott)
spectral 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/D10388

AFFECTED FILES
  hgext/split.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
@@ -1063,7 +1063,6 @@
   |
   o  public 0:222799e2f90b r0
   
-FIXME: This should not show "So far it has been split into"
   $ printf 'd\na\n' | HGEDITOR=cat hg split || true
   diff --git a/foo b/foo
   new file mode 100644
@@ -1076,9 +1075,7 @@
   examine changes to 'foo'?
   (enter ? for help) [Ynesfdaq?] a
   
-  HG: Splitting ae694b2901bb. So far it has been split into:
-  HG: - 0:222799e2f90b "r0"
-  HG: Write commit message for the next split changeset.
+  HG: Splitting ae694b2901bb. Write commit message for the first split 
changeset.
   foo
   
   
@@ -1094,13 +1091,12 @@
   rollback completed (obsstore-on !)
   abort: changeset ae694b2901bb cannot obsolete itself (obsstore-on !)
 FIXME: this should not have stripped the commit we just no-op split
-(obsstore-off only), or made r0 draft.
+(obsstore-off only)
   $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
   warning: ignoring unknown working parent ae694b2901bb! (obsstore-off !)
   @  draft 1:ae694b2901bb foo (obsstore-on !)
   | (obsstore-on !)
-  o  public 0:222799e2f90b r0 (obsstore-on !)
-  o  draft 0:222799e2f90b r0 (obsstore-off !)
+  o  public 0:222799e2f90b r0
   
 
 Now try the same thing but modifying the message so we don't trigger the
@@ -1121,7 +1117,6 @@
   $ cat > $TESTTMP/messages < message1
   > EOF
-FIXME: This should not show "So far it has been split into"
   $ printf 'd\na\n' | HGEDITOR="\"$PYTHON\" $TESTTMP/editor.py" hg split
   diff --git a/foo b/foo
   new file mode 100644
@@ -1134,9 +1129,7 @@
   examine changes to 'foo'?
   (enter ? for help) [Ynesfdaq?] a
   
-  EDITOR: HG: Splitting ae694b2901bb. So far it has been split into:
-  EDITOR: HG: - 0:222799e2f90b "r0"
-  EDITOR: HG: Write commit message for the next split changeset.
+  EDITOR: HG: Splitting ae694b2901bb. Write commit message for the first split 
changeset.
   EDITOR: foo
   EDITOR: 
   EDITOR: 
@@ -1148,15 +1141,13 @@
   EDITOR: HG: added foo
   created new head
   saved backup bundle to 
$TESTTMP/noop2/.hg/strip-backup/ae694b2901bb-28e0b457-split.hg (obsstore-off !)
-FIXME: this should not have made r0 draft
   $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
   @  draft 1:de675559d3f9 message1 (obsstore-off !)
   @  draft 2:de675559d3f9 message1 (obsstore-on !)
   |
-  o  draft 0:222799e2f90b r0
+  o  public 0:222799e2f90b r0
   
 #if obsstore-on
-FIXME: this should not have marked 222799e (r0) as a precursor of anything.
   $ hg debugobsolete
-  ae694b2901bb8b0f8c4b5e075ddec0d63468d57a 
222799e2f90be09ccbe49f519c4615d8375a9242 
de675559d3f93ffc822c6eb7490e5c73033f17c7 0 * (glob)
+  ae694b2901bb8b0f8c4b5e075ddec0d63468d57a 
de675559d3f93ffc822c6eb7490e5c73033f17c7 0 * (glob)
 #endif
diff --git a/hgext/split.py b/hgext/split.py
--- a/hgext/split.py
+++ b/hgext/split.py
@@ -171,9 +171,13 @@
 b'message': header + ctx.description(),
 }
 )
+origctx = repo[b'.']
 commands.commit(ui, repo, **pycompat.strkwargs(opts))
 newctx = repo[b'.']
-committed.append(newctx)
+# Ensure user didn't do a "no-op" split (such as deselecting
+# everything).
+if origctx.node() != newctx.node():
+committed.append(newctx)
 
 if not committed:
 raise error.InputError(_(b'cannot split an empty revision'))



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


D10389: split: avoid strip if split is a no-op (identical to original)

2021-04-13 Thread spectral (Kyle Lippincott)
spectral 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/D10389

AFFECTED FILES
  hgext/split.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
@@ -1086,16 +1086,9 @@
   HG: branch 'default'
   HG: added foo
   warning: commit already existed in the repository!
-  saved backup bundle to 
$TESTTMP/noop/.hg/strip-backup/ae694b2901bb-28e0b457-split.hg (obsstore-off !)
-  transaction abort! (obsstore-on !)
-  rollback completed (obsstore-on !)
-  abort: changeset ae694b2901bb cannot obsolete itself (obsstore-on !)
-FIXME: this should not have stripped the commit we just no-op split
-(obsstore-off only)
   $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
-  warning: ignoring unknown working parent ae694b2901bb! (obsstore-off !)
-  @  draft 1:ae694b2901bb foo (obsstore-on !)
-  | (obsstore-on !)
+  @  draft 1:ae694b2901bb foo
+  |
   o  public 0:222799e2f90b r0
   
 
diff --git a/hgext/split.py b/hgext/split.py
--- a/hgext/split.py
+++ b/hgext/split.py
@@ -182,12 +182,15 @@
 if not committed:
 raise error.InputError(_(b'cannot split an empty revision'))
 
-scmutil.cleanupnodes(
-repo,
-{ctx.node(): [c.node() for c in committed]},
-operation=b'split',
-fixphase=True,
-)
+if len(committed) != 1 or committed[0].node() != ctx.node():
+# Ensure we don't strip a node if we produce the same commit as already
+# exists
+scmutil.cleanupnodes(
+repo,
+{ctx.node(): [c.node() for c in committed]},
+operation=b'split',
+fixphase=True,
+)
 
 return committed[-1]
 



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


D10387: split: add test demonstrating issue with empty splits adjusting phases

2021-04-13 Thread spectral (Kyle Lippincott)
spectral 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/D10387

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
@@ -1046,3 +1046,117 @@
   [ ui.warning|rollback completed]
   [ ui.error|abort: empty commit message]
   [10]
+
+Test that creating an empty split or "no-op"
+(identical to original) commit doesn't cause chaos
+--
+
+  $ hg init $TESTTMP/noop
+  $ cd $TESTTMP/noop
+  $ echo r0 > r0
+  $ hg ci -qAm r0
+  $ hg phase -p
+  $ echo foo > foo
+  $ hg ci -qAm foo
+  $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
+  @  draft 1:ae694b2901bb foo
+  |
+  o  public 0:222799e2f90b r0
+  
+FIXME: This should not show "So far it has been split into"
+  $ printf 'd\na\n' | HGEDITOR=cat hg split || true
+  diff --git a/foo b/foo
+  new file mode 100644
+  examine changes to 'foo'?
+  (enter ? for help) [Ynesfdaq?] d
+  
+  no changes to record
+  diff --git a/foo b/foo
+  new file mode 100644
+  examine changes to 'foo'?
+  (enter ? for help) [Ynesfdaq?] a
+  
+  HG: Splitting ae694b2901bb. So far it has been split into:
+  HG: - 0:222799e2f90b "r0"
+  HG: Write commit message for the next split changeset.
+  foo
+  
+  
+  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+  HG: Leave message empty to abort commit.
+  HG: --
+  HG: user: test
+  HG: branch 'default'
+  HG: added foo
+  warning: commit already existed in the repository!
+  saved backup bundle to 
$TESTTMP/noop/.hg/strip-backup/ae694b2901bb-28e0b457-split.hg (obsstore-off !)
+  transaction abort! (obsstore-on !)
+  rollback completed (obsstore-on !)
+  abort: changeset ae694b2901bb cannot obsolete itself (obsstore-on !)
+FIXME: this should not have stripped the commit we just no-op split
+(obsstore-off only), or made r0 draft.
+  $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
+  warning: ignoring unknown working parent ae694b2901bb! (obsstore-off !)
+  @  draft 1:ae694b2901bb foo (obsstore-on !)
+  | (obsstore-on !)
+  o  public 0:222799e2f90b r0 (obsstore-on !)
+  o  draft 0:222799e2f90b r0 (obsstore-off !)
+  
+
+Now try the same thing but modifying the message so we don't trigger the
+identical changeset failures
+
+  $ hg init $TESTTMP/noop2
+  $ cd $TESTTMP/noop2
+  $ echo r0 > r0
+  $ hg ci -qAm r0
+  $ hg phase -p
+  $ echo foo > foo
+  $ hg ci -qAm foo
+  $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
+  @  draft 1:ae694b2901bb foo
+  |
+  o  public 0:222799e2f90b r0
+  
+  $ cat > $TESTTMP/messages < message1
+  > EOF
+FIXME: This should not show "So far it has been split into"
+  $ printf 'd\na\n' | HGEDITOR="\"$PYTHON\" $TESTTMP/editor.py" hg split
+  diff --git a/foo b/foo
+  new file mode 100644
+  examine changes to 'foo'?
+  (enter ? for help) [Ynesfdaq?] d
+  
+  no changes to record
+  diff --git a/foo b/foo
+  new file mode 100644
+  examine changes to 'foo'?
+  (enter ? for help) [Ynesfdaq?] a
+  
+  EDITOR: HG: Splitting ae694b2901bb. So far it has been split into:
+  EDITOR: HG: - 0:222799e2f90b "r0"
+  EDITOR: HG: Write commit message for the next split changeset.
+  EDITOR: foo
+  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: added foo
+  created new head
+  saved backup bundle to 
$TESTTMP/noop2/.hg/strip-backup/ae694b2901bb-28e0b457-split.hg (obsstore-off !)
+FIXME: this should not have made r0 draft
+  $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
+  @  draft 1:de675559d3f9 message1 (obsstore-off !)
+  @  draft 2:de675559d3f9 message1 (obsstore-on !)
+  |
+  o  draft 0:222799e2f90b r0
+  
+#if obsstore-on
+FIXME: this should not have marked 222799e (r0) as a precursor of anything.
+  $ hg debugobsolete
+  ae694b2901bb8b0f8c4b5e075ddec0d63468d57a 
222799e2f90be09ccbe49f519c4615d8375a9242 
de675559d3f93ffc822c6eb7490e5c73033f17c7 0 * (glob)
+#endif



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


D10386: tests: avoid use of "python", which may not even be installed

2021-04-13 Thread spectral (Kyle Lippincott)
spectral 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/D10386

AFFECTED FILES
  tests/test-convert-cvs.t
  tests/test-merge-tools.t

CHANGE DETAILS

diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t
--- a/tests/test-merge-tools.t
+++ b/tests/test-merge-tools.t
@@ -1921,7 +1921,7 @@
 Binary files capability checking
 
   $ hg update -q -C 0
-  $ python < with open('b', 'wb') as fp:
   > fp.write(b'\x00\x01\x02\x03')
   > EOF
@@ -1929,7 +1929,7 @@
   $ hg commit -qm "add binary file (#1)"
 
   $ hg update -q -C 0
-  $ python < with open('b', 'wb') as fp:
   > fp.write(b'\x03\x02\x01\x00')
   > EOF
diff --git a/tests/test-convert-cvs.t b/tests/test-convert-cvs.t
--- a/tests/test-convert-cvs.t
+++ b/tests/test-convert-cvs.t
@@ -521,7 +521,7 @@
 |cp932 |\x82\xa0  |  x  x o|
 
   $ mkdir -p cvsrepo/transcoding
-  $ python < fp = open('cvsrepo/transcoding/file,v', 'wb')
   > fp.write((b'''
   > head   1.4;



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


D10385: push-dests: move the code around missing default dest inside `get_push_paths`

2021-04-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This function has a clear semantic and moving the code dealing with this 
inside
  it will help reduce duplication.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/utils/urlutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py
+++ b/mercurial/utils/urlutil.py
@@ -453,7 +453,10 @@
 elif b'default' in ui.paths:
 yield ui.paths[b'default']
 else:
-yield None
+raise error.ConfigError(
+_(b'default repository not configured!'),
+hint=_(b"see 'hg help config.paths'"),
+)
 else:
 for dest in dests:
 yield ui.getpath(dest)
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5702,11 +5702,6 @@
 some_pushed = False
 result = 0
 for path in urlutil.get_push_paths(repo, ui, dests):
-if not path:
-raise error.ConfigError(
-_(b'default repository not configured!'),
-hint=_(b"see 'hg help config.paths'"),
-)
 dest = path.pushloc or path.loc
 branches = (path.branch, opts.get(b'branch') or [])
 ui.status(_(b'pushing to %s\n') % urlutil.hidepassword(dest))



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


D10383: outgoing: merge the code handling --graph with the main one

2021-04-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The --graph code had its own copy of the logic. With the previous 
reorganisation
  of the code, we can now merge it with the main code, reducing fragile
  complication.
  
  As a side effect, `hg out --graph` now use the right return code when they are
  nothing outgoing. This explain the change to output in
  `tests/test-largefiles-misc.t`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/hg.py
  tests/test-largefiles-misc.t

CHANGE DETAILS

diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t
--- a/tests/test-largefiles-misc.t
+++ b/tests/test-largefiles-misc.t
@@ -675,6 +675,7 @@
   searching for changes
   no changes found
   largefiles: no files to upload
+  [1]
 
 check messages when there are files to upload:
 
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -32,6 +32,7 @@
 error,
 exchange,
 extensions,
+graphmod,
 httppeer,
 localrepo,
 lock,
@@ -1382,18 +1383,29 @@
 
 
 def outgoing(ui, repo, dest, opts):
-
+if opts.get(b'graph'):
+logcmdutil.checkunsupportedgraphflags([], opts)
 o, other = _outgoing(ui, repo, dest, opts)
 ret = 1
 try:
 if o:
 ret = 0
 
-ui.pager(b'outgoing')
-displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
-for n in _outgoing_filter(repo, o, opts):
-displayer.show(repo[n])
-displayer.close()
+if opts.get(b'graph'):
+revdag = logcmdutil.graphrevs(repo, o, opts)
+ui.pager(b'outgoing')
+displayer = logcmdutil.changesetdisplayer(
+ui, repo, opts, buffered=True
+)
+logcmdutil.displaygraph(
+ui, repo, revdag, displayer, graphmod.asciiedges
+)
+else:
+ui.pager(b'outgoing')
+displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
+for n in _outgoing_filter(repo, o, opts):
+displayer.show(repo[n])
+displayer.close()
 cmdutil.outgoinghooks(ui, repo, other, opts, o)
 ret = min(ret, _outgoing_recurse(ui, repo, dest, opts))
 return ret  # exit code is zero since we found outgoing changes
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4971,22 +4971,6 @@
 )
 
 opts = pycompat.byteskwargs(opts)
-if opts.get(b'graph'):
-logcmdutil.checkunsupportedgraphflags([], opts)
-o, other = hg._outgoing(ui, repo, dest, opts)
-if not o:
-cmdutil.outgoinghooks(ui, repo, other, opts, o)
-return
-
-revdag = logcmdutil.graphrevs(repo, o, opts)
-ui.pager(b'outgoing')
-displayer = logcmdutil.changesetdisplayer(ui, repo, opts, 
buffered=True)
-logcmdutil.displaygraph(
-ui, repo, revdag, displayer, graphmod.asciiedges
-)
-cmdutil.outgoinghooks(ui, repo, other, opts, o)
-return 0
-
 if opts.get(b'bookmarks'):
 dest = path.pushloc or path.loc
 other = hg.peer(repo, opts, dest)



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


D10384: push-dests: rework the handling of default value

2021-04-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This new core is more straightforward and doing this early will make the next
  changeset simpler.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/utils/urlutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py
+++ b/mercurial/utils/urlutil.py
@@ -448,9 +448,15 @@
 def get_push_paths(repo, ui, dests):
 """yields all the `path` selected as push destination by `dests`"""
 if not dests:
-dests = [None]
-for dest in dests:
-yield ui.getpath(dest, default=(b'default-push', b'default'))
+if b'default-push' in ui.paths:
+yield ui.paths[b'default-push']
+elif b'default' in ui.paths:
+yield ui.paths[b'default']
+else:
+yield None
+else:
+for dest in dests:
+yield ui.getpath(dest)
 
 
 def get_pull_paths(repo, ui, sources, default_branches=()):



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


D10382: outgoing: move filtering logic in its own function

2021-04-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This move code dedicated to a single purpose together and make the main code
  simpler. Right when we are getting ready to make it more complex :-D

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/hg.py

CHANGE DETAILS

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1358,27 +1358,40 @@
 return ret
 
 
+def _outgoing_filter(repo, revs, opts):
+"""apply revision filtering/ordering option for outgoing"""
+limit = logcmdutil.getlimit(opts)
+no_merges = opts.get(b'no_merges')
+if opts.get(b'newest_first'):
+revs.reverse()
+if limit is None and not no_merges:
+for r in revs:
+yield r
+return
+
+count = 0
+cl = repo.changelog
+for n in revs:
+if limit is not None and count >= limit:
+break
+parents = [p for p in cl.parents(n) if p != nullid]
+if no_merges and len(parents) == 2:
+continue
+count += 1
+yield n
+
+
 def outgoing(ui, repo, dest, opts):
 
-limit = logcmdutil.getlimit(opts)
 o, other = _outgoing(ui, repo, dest, opts)
 ret = 1
 try:
 if o:
 ret = 0
 
-if opts.get(b'newest_first'):
-o.reverse()
 ui.pager(b'outgoing')
 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
-count = 0
-for n in o:
-if limit is not None and count >= limit:
-break
-parents = [p for p in repo.changelog.parents(n) if p != nullid]
-if opts.get(b'no_merges') and len(parents) == 2:
-continue
-count += 1
+for n in _outgoing_filter(repo, o, opts):
 displayer.show(repo[n])
 displayer.close()
 cmdutil.outgoinghooks(ui, repo, other, opts, o)



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


D10380: outgoing: remove some early return

2021-04-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Since 066b8d8f75b8 
, 
the push command accept multiple destination. However `hg
  outgoing` does not. On the way to fix this, we need to clean up the outgoing
  code. We start with removing some early return to make the code ready to house
  more changes.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/hg.py

CHANGE DETAILS

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1360,28 +1360,28 @@
 
 limit = logcmdutil.getlimit(opts)
 o, other = _outgoing(ui, repo, dest, opts)
+ret = 1
 try:
-if not o:
-cmdutil.outgoinghooks(ui, repo, other, opts, o)
-return recurse()
+if o:
+ret = 0
 
-if opts.get(b'newest_first'):
-o.reverse()
-ui.pager(b'outgoing')
-displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
-count = 0
-for n in o:
-if limit is not None and count >= limit:
-break
-parents = [p for p in repo.changelog.parents(n) if p != nullid]
-if opts.get(b'no_merges') and len(parents) == 2:
-continue
-count += 1
-displayer.show(repo[n])
-displayer.close()
+if opts.get(b'newest_first'):
+o.reverse()
+ui.pager(b'outgoing')
+displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
+count = 0
+for n in o:
+if limit is not None and count >= limit:
+break
+parents = [p for p in repo.changelog.parents(n) if p != nullid]
+if opts.get(b'no_merges') and len(parents) == 2:
+continue
+count += 1
+displayer.show(repo[n])
+displayer.close()
 cmdutil.outgoinghooks(ui, repo, other, opts, o)
-recurse()
-return 0  # exit code is zero since we found outgoing changes
+ret = min(ret, recurse())
+return ret  # exit code is zero since we found outgoing changes
 finally:
 other.close()
 



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


D10381: outgoing: make `recurse` a real function

2021-04-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If we want to use this in a loop, we need to be able to pass argument.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/hg.py

CHANGE DETAILS

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1348,15 +1348,17 @@
 raise
 
 
+def _outgoing_recurse(ui, repo, dest, opts):
+ret = 1
+if opts.get(b'subrepos'):
+ctx = repo[None]
+for subpath in sorted(ctx.substate):
+sub = ctx.sub(subpath)
+ret = min(ret, sub.outgoing(ui, dest, opts))
+return ret
+
+
 def outgoing(ui, repo, dest, opts):
-def recurse():
-ret = 1
-if opts.get(b'subrepos'):
-ctx = repo[None]
-for subpath in sorted(ctx.substate):
-sub = ctx.sub(subpath)
-ret = min(ret, sub.outgoing(ui, dest, opts))
-return ret
 
 limit = logcmdutil.getlimit(opts)
 o, other = _outgoing(ui, repo, dest, opts)
@@ -1380,7 +1382,7 @@
 displayer.show(repo[n])
 displayer.close()
 cmdutil.outgoinghooks(ui, repo, other, opts, o)
-ret = min(ret, recurse())
+ret = min(ret, _outgoing_recurse(ui, repo, dest, opts))
 return ret  # exit code is zero since we found outgoing changes
 finally:
 other.close()



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


D10378: urlutil: add a `get_pull_paths` to perform the pull destination logic

2021-04-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  As is this changeset does not change anything. However having an official 
empty
  point will help unifying the logic and encapsulate the details and update the
  logic to support path definition pointing to multiple other path.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/utils/urlutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py
+++ b/mercurial/utils/urlutil.py
@@ -453,6 +453,15 @@
 yield ui.getpath(dest, default=(b'default-push', b'default'))
 
 
+def get_pull_paths(repo, ui, sources, default_branches=()):
+"""yields all the `(path, branch)` selected as pull source by `sources`"""
+if not sources:
+sources = [b'default']
+for source in sources:
+url = ui.expandpath(source)
+yield parseurl(url, default_branches)
+
+
 def parseurl(path, branches=None):
 '''parse url#branch, returning (url, (branch, branches))'''
 u = url(path)
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5386,12 +5386,8 @@
 hint = _(b'use hg pull followed by hg update DEST')
 raise error.InputError(msg, hint=hint)
 
-if not sources:
-sources = [b'default']
-for source in sources:
-source, branches = urlutil.parseurl(
-ui.expandpath(source), opts.get(b'branch')
-)
+sources = urlutil.get_pull_paths(repo, ui, sources, opts.get(b'branch'))
+for source, branches in sources:
 ui.status(_(b'pulling from %s\n') % urlutil.hidepassword(source))
 ui.flush()
 other = hg.peer(repo, opts, source)



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


D10379: infinitepush: use the new function to determine push destination

2021-04-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Since 066b8d8f75b8 
, 
the push command accept multiple destination. `infinitepush`
  was not aware of that. We now use the new `urlutil.get_push_paths` function to
  determine the push destination, fixing the issue. This will also make future
  evolution of that logic transparent for infinitepush
  
  We still disallow push to multiple destinations if infinite push is enabled
  because I don't know what this means for infinite push. However user will now
  get a clear error message instead of a crash.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/infinitepush/__init__.py

CHANGE DETAILS

diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py
--- a/hgext/infinitepush/__init__.py
+++ b/hgext/infinitepush/__init__.py
@@ -811,7 +811,7 @@
 return common, True, remoteheads
 
 
-def _push(orig, ui, repo, dest=None, *args, **opts):
+def _push(orig, ui, repo, *dests, **opts):
 opts = pycompat.byteskwargs(opts)
 bookmark = opts.get(b'bookmark')
 # we only support pushing one infinitepush bookmark at once
@@ -839,18 +839,18 @@
 oldphasemove = extensions.wrapfunction(
 exchange, b'_localphasemove', _phasemove
 )
-# Copy-paste from `push` command
-path = ui.getpath(dest, default=(b'default-push', b'default'))
-if not path:
-raise error.Abort(
-_(b'default repository not configured!'),
-hint=_(b"see 'hg help config.paths'"),
-)
+
+paths = list(urlutil.get_push_paths(repo, ui, dests))
+if len(paths) > 1:
+msg = _(b'cannot push to multiple path with infinitepush')
+raise error.Abort(msg)
+
+path = paths[0]
 destpath = path.pushloc or path.loc
 # Remote scratch bookmarks will be deleted because remotenames doesn't
 # know about them. Let's save it before push and restore after
 remotescratchbookmarks = _readscratchremotebookmarks(ui, repo, 
destpath)
-result = orig(ui, repo, dest, *args, **pycompat.strkwargs(opts))
+result = orig(ui, repo, *dests, **pycompat.strkwargs(opts))
 if common.isremotebooksenabled(ui):
 if bookmark and scratchpush:
 other = hg.peer(repo, opts, destpath)



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


D10377: urlutil: add a `get_push_paths` to perform the push destination logic

2021-04-13 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  As is this changeset does not change anything. However having an official 
empty
  point will help unifying the logic and encapsulate the details and update the
  logic to support path definition pointing to multiple other path.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/utils/urlutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py
+++ b/mercurial/utils/urlutil.py
@@ -445,6 +445,14 @@
 return bytes(u)
 
 
+def get_push_paths(repo, ui, dests):
+"""yields all the `path` selected as push destination by `dests`"""
+if not dests:
+dests = [None]
+for dest in dests:
+yield ui.getpath(dest, default=(b'default-push', b'default'))
+
+
 def parseurl(path, branches=None):
 '''parse url#branch, returning (url, (branch, branches))'''
 u = url(path)
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5719,12 +5719,9 @@
 # this lets simultaneous -r, -b options continue working
 opts.setdefault(b'rev', []).append(b"null")
 
-if not dests:
-dests = [None]
 some_pushed = False
 result = 0
-for dest in dests:
-path = ui.getpath(dest, default=(b'default-push', b'default'))
+for path in urlutil.get_push_paths(repo, ui, dests):
 if not path:
 raise error.ConfigError(
 _(b'default repository not configured!'),



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


Re: development heads up: push/pull improvements

2021-04-13 Thread Pierre-Yves David



On 4/13/21 3:03 AM, Manuel Jacob wrote:

On 17/03/2021 16.05, Pierre-Yves David wrote:

Hello everyone,

I have been working on improvements to push and pull. The core goal 
can be summarized as:

* make it simpler to push/pull to multiple destinations
* make it simpler to control default behavior from various destinations.

The first bits of this already landed.

* Support for multiple destinations for pull (push is in review))
   https://www.mercurial-scm.org/repo/hg-committed/rev/685383486d0a
* Support for default value for path suboption:
   https://www.mercurial-scm.org/repo/hg-committed/rev/e3f15c553522

My plan is to follow up with an handful of other improvements:

1) Make it possible for a path (in [paths] section), to reference 
another one using `path://PATHNAME`, inheriting its configuration. The 
inherited configuration can then be overwritten in the new path


Regarding this, I have done most of the necessary work for this last 
week, and I am in the process making the patches ready and sent.


The main issue is the impact on `hg path` and related templates, because 
the data structure change.


I is also not possible to simply turn the [paths] entry into a "list" 
field since this will break too much BC for people using " " in their path.


I am thinking about a `my-path:urls` attribute ?


2) Make is possible for a path to reference a list of other paths. eg:

   [paths]
   main = https://mercurial-scm.org/repo/hg
   committed = https://mercurial-scm.org/repo/hg-committed
   all = path://main, path://committed

3) add sub-options to control usage of existing flags. For example the 
following config would make `--new-branch` on by default for the 
`devel` path.


   [paths]
   devel = ssh://foo…
   devel:new-branch=yes

The possible values would be:

* never: the flag is never set, using --new-branch would abort the push
* no: the flag default to False, passing --new-branch enables it
* default: the default value for the flag is used
* yes: the flag default to True, passing --no-new-branch disables it
* always: the flag is always set, --no-new-branch would abort the push


I really like this feature. I don’t really see the point in "always", 
but we can have it for symmetry with "never".


Speaking of defaults, it would make sense to me to allow pushing new 
branches in draft phase by default, since the original point of 
disallowing it was probably to prevent people from making the branch 
name permanent, which isn’t a problem with draft changesets.


This is still going to be an issue, because once pushed, they can easily 
get "silently" published, and we don't have a check for that. Various 
things the persistent branch are unfortunate, but I don't think we have 
much room to improve them.


One nice thing would be to be able to specify the flags for all paths 
matching some pattern. This may seem complicated, but doesn’t add much 
more conceptual overhead in addition to the `*` special path.


This sounds a good idea, (but I don't plan to write it myself in the 
short terms)


For the name of the config, see the discussion below (we should use the 
same names for the config and CLI flags).


+1 for using the same name




4) adding more flag

They are a couple of check that does not have there own flag yet and 
are only covered by `--force`. For example to push new heads. I know 
that Manuel Jacob had idea about how to express these flag, so I CCed 
him on this email.


The basic idea is simply to have a flag for each check to turn it off or 
on.


One issue is the naming, which probably requires some bideshedding. The 
existing "--new-branch" never really made sense to me (it sounds as if 
it always added a new branch instead of disabling some check).


Before shipping a bunch of new flags, it would be good to get it right. 
Another reason for having a better naming scheme would be that a common 
prefix (not every flag will start with "new") creates a bit of grouping 
and aids auto-completion.


For disabling checks, prefixing it with "--allow-" makes sense to me. 
The first flags to add would be:

--allow-new-branch: allow adding new branch on destination
--allow-new-head: allow increasing the number of heads on a branch on 
destination


So --allow-new-branch and --no-allow-new-branch ? (or maybe 
--deny-new-branch) ?


For the checks about not pushing obsolete, orphan, divergent and similar 
changesets, I proposed some changes (I think the existing checks miss 
problematic cases and reject legitimate ones).


Do you have details on these case ?

Pierre-Yves was concerned 
about breaking expectations of users relying on the old behavior, so 
this was never released.


Was I ? Evolution is still experimental, so reasonable behavior change 
should be fine, but there might have been other issues.


By making it possible to turn off and on 
various variants of the checks, new behaviors can be designed and 
developed in an incremental way. This is especially useful considering 
that