Patchwork [9,of,9,paths,v2] commands.push: finish converting to new path API

login
register
mail settings
Submitter Gregory Szorc
Date March 1, 2015, 9:50 p.m.
Message ID <9d50c4be6b9bef95d042.1425246648@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/7870/
State Changes Requested
Headers show

Comments

Gregory Szorc - March 1, 2015, 9:50 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1423511376 28800
#      Mon Feb 09 11:49:36 2015 -0800
# Node ID 9d50c4be6b9bef95d042974b1b792af38c0a88dd
# Parent  86b20c6cbde1cf67e7401f7541cbfca233d34362
commands.push: finish converting to new path API

This could be combined with the previous patch. However, the
previous patch changed output and I wanted to isolate
output-changing changes from other changes.
Augie Fackler - March 3, 2015, 7:46 p.m.
On Sun, Mar 01, 2015 at 01:50:48PM -0800, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1423511376 28800
> #      Mon Feb 09 11:49:36 2015 -0800
> # Node ID 9d50c4be6b9bef95d042974b1b792af38c0a88dd
> # Parent  86b20c6cbde1cf67e7401f7541cbfca233d34362
> commands.push: finish converting to new path API

I took a pass through this, and didn't spot anything beyond avoiding
the import cycle. I think it makes sense as a cleanup, but it's big
enough I'd like someone else to take a look at it too.

>
> This could be combined with the previous patch. However, the
> previous patch changed output and I wanted to isolate
> output-changing changes from other changes.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -5084,18 +5084,18 @@ def push(ui, repo, dest=None, **opts):
>                  # this lets simultaneous -r, -b options continue working
>                  opts.setdefault('rev', []).append("null")
>
>      path = ui.paths.getpath(dest, default='push', require=True)
> -    dest = ui.expandpath(dest or 'default-push', dest or 'default')
> -    dest, branches = hg.parseurl(dest, opts.get('branch'))
> -    ui.status(_('pushing to %s\n') % util.hidepassword(dest))
> +    url = path.url
> +    branches = [path.rev, opts.get('branch', [])]
> +    ui.status(_('pushing to %s\n') % util.hidepassword(url))
>      revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
> -    other = hg.peer(repo, opts, dest)
> +    other = hg.peer(repo, opts, url)
>
>      if revs:
>          revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)]
>
> -    repo._subtoppath = dest
> +    repo._subtoppath = url
>      try:
>          # push subrepos depth-first for coherent ordering
>          c = repo['']
>          subs = c.substate # only repos that are committed
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5084,18 +5084,18 @@  def push(ui, repo, dest=None, **opts):
                 # this lets simultaneous -r, -b options continue working
                 opts.setdefault('rev', []).append("null")
 
     path = ui.paths.getpath(dest, default='push', require=True)
-    dest = ui.expandpath(dest or 'default-push', dest or 'default')
-    dest, branches = hg.parseurl(dest, opts.get('branch'))
-    ui.status(_('pushing to %s\n') % util.hidepassword(dest))
+    url = path.url
+    branches = [path.rev, opts.get('branch', [])]
+    ui.status(_('pushing to %s\n') % util.hidepassword(url))
     revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
-    other = hg.peer(repo, opts, dest)
+    other = hg.peer(repo, opts, url)
 
     if revs:
         revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)]
 
-    repo._subtoppath = dest
+    repo._subtoppath = url
     try:
         # push subrepos depth-first for coherent ordering
         c = repo['']
         subs = c.substate # only repos that are committed