mercurial/commands.py
changeset 10379 a78bfaf988e1
parent 10376 a2950e053614
child 10384 832f35386067
equal deleted inserted replaced
10377:04e1e6743809 10379:a78bfaf988e1
   536                     if p not in seen:
   536                     if p not in seen:
   537                         seen[p] = 1
   537                         seen[p] = 1
   538                         visit.append(p)
   538                         visit.append(p)
   539     else:
   539     else:
   540         dest = ui.expandpath(dest or 'default-push', dest or 'default')
   540         dest = ui.expandpath(dest or 'default-push', dest or 'default')
   541         dest, branches = hg.parseurl(dest)
   541         dest, branches = hg.parseurl(dest, opts.get('branch'))
   542         other = hg.repository(cmdutil.remoteui(repo, opts), dest)
   542         other = hg.repository(cmdutil.remoteui(repo, opts), dest)
   543         revs, checkout = hg.addbranchrevs(repo, other, branches, revs)
   543         revs, checkout = hg.addbranchrevs(repo, other, branches, revs)
   544         o = repo.findoutgoing(other, force=opts.get('force'))
   544         o = repo.findoutgoing(other, force=opts.get('force'))
   545 
   545 
   546     if revs:
   546     if revs:
   605     will be the null changeset). Otherwise, clone will initially check
   605     will be the null changeset). Otherwise, clone will initially check
   606     out (in order of precedence):
   606     out (in order of precedence):
   607 
   607 
   608     a) the changeset, tag or branch specified with -u/--updaterev
   608     a) the changeset, tag or branch specified with -u/--updaterev
   609     b) the changeset, tag or branch given with the first -r/--rev
   609     b) the changeset, tag or branch given with the first -r/--rev
   610     c) the branch given with the url#branch source syntax
   610     c) the branch given with the first -b/--branch
   611     d) the head of the default branch
   611     d) the branch given with the url#branch source syntax
       
   612     e) the head of the default branch
   612 
   613 
   613     Use 'hg clone -u . src dst' to checkout the source repository's
   614     Use 'hg clone -u . src dst' to checkout the source repository's
   614     parent changeset (applicable for local source repositories only).
   615     parent changeset (applicable for local source repositories only).
   615 
   616 
   616     A set of changesets (tags, or branch names) to pull may be specified
   617     A set of changesets (tags, or branch names) to pull may be specified
   649 
   650 
   650     hg.clone(cmdutil.remoteui(ui, opts), source, dest,
   651     hg.clone(cmdutil.remoteui(ui, opts), source, dest,
   651              pull=opts.get('pull'),
   652              pull=opts.get('pull'),
   652              stream=opts.get('uncompressed'),
   653              stream=opts.get('uncompressed'),
   653              rev=opts.get('rev'),
   654              rev=opts.get('rev'),
   654              update=opts.get('updaterev') or not opts.get('noupdate'))
   655              update=opts.get('updaterev') or not opts.get('noupdate'),
       
   656              branch=opts.get('branch'))
   655 
   657 
   656 def commit(ui, repo, *pats, **opts):
   658 def commit(ui, repo, *pats, **opts):
   657     """commit the specified files or all outstanding changes
   659     """commit the specified files or all outstanding changes
   658 
   660 
   659     Commit changes to the given files into the repository. Unlike a
   661     Commit changes to the given files into the repository. Unlike a
  1919     changesets twice if the incoming is followed by a pull.
  1921     changesets twice if the incoming is followed by a pull.
  1920 
  1922 
  1921     See pull for valid source format details.
  1923     See pull for valid source format details.
  1922     """
  1924     """
  1923     limit = cmdutil.loglimit(opts)
  1925     limit = cmdutil.loglimit(opts)
  1924     source, branches = hg.parseurl(ui.expandpath(source))
  1926     source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
  1925     other = hg.repository(cmdutil.remoteui(repo, opts), source)
  1927     other = hg.repository(cmdutil.remoteui(repo, opts), source)
  1926     ui.status(_('comparing with %s\n') % url.hidepassword(source))
  1928     ui.status(_('comparing with %s\n') % url.hidepassword(source))
  1927     revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
  1929     revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
  1928     if revs:
  1930     if revs:
  1929         revs = [other.lookup(rev) for rev in revs]
  1931         revs = [other.lookup(rev) for rev in revs]
  2208 
  2210 
  2209     See pull for details of valid destination formats.
  2211     See pull for details of valid destination formats.
  2210     """
  2212     """
  2211     limit = cmdutil.loglimit(opts)
  2213     limit = cmdutil.loglimit(opts)
  2212     dest = ui.expandpath(dest or 'default-push', dest or 'default')
  2214     dest = ui.expandpath(dest or 'default-push', dest or 'default')
  2213     dest, branches = hg.parseurl(dest)
  2215     dest, branches = hg.parseurl(dest, opts.get('branch'))
  2214     revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
  2216     revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
  2215     if revs:
  2217     if revs:
  2216         revs = [repo.lookup(rev) for rev in revs]
  2218         revs = [repo.lookup(rev) for rev in revs]
  2217 
  2219 
  2218     other = hg.repository(cmdutil.remoteui(repo, opts), dest)
  2220     other = hg.repository(cmdutil.remoteui(repo, opts), dest)
  2328     where X is the last changeset listed by hg incoming.
  2330     where X is the last changeset listed by hg incoming.
  2329 
  2331 
  2330     If SOURCE is omitted, the 'default' path will be used.
  2332     If SOURCE is omitted, the 'default' path will be used.
  2331     See 'hg help urls' for more information.
  2333     See 'hg help urls' for more information.
  2332     """
  2334     """
  2333     source, branches = hg.parseurl(ui.expandpath(source))
  2335     source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
  2334     other = hg.repository(cmdutil.remoteui(repo, opts), source)
  2336     other = hg.repository(cmdutil.remoteui(repo, opts), source)
  2335     ui.status(_('pulling from %s\n') % url.hidepassword(source))
  2337     ui.status(_('pulling from %s\n') % url.hidepassword(source))
  2336     revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
  2338     revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
  2337     if revs:
  2339     if revs:
  2338         try:
  2340         try:
  2366 
  2368 
  2367     Please see 'hg help urls' for important details about ``ssh://``
  2369     Please see 'hg help urls' for important details about ``ssh://``
  2368     URLs. If DESTINATION is omitted, a default path will be used.
  2370     URLs. If DESTINATION is omitted, a default path will be used.
  2369     """
  2371     """
  2370     dest = ui.expandpath(dest or 'default-push', dest or 'default')
  2372     dest = ui.expandpath(dest or 'default-push', dest or 'default')
  2371     dest, branches = hg.parseurl(dest)
  2373     dest, branches = hg.parseurl(dest, opts.get('branch'))
  2372     revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
  2374     revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
  2373     other = hg.repository(cmdutil.remoteui(repo, opts), dest)
  2375     other = hg.repository(cmdutil.remoteui(repo, opts), dest)
  2374     ui.status(_('pushing to %s\n') % url.hidepassword(dest))
  2376     ui.status(_('pushing to %s\n') % url.hidepassword(dest))
  2375     if revs:
  2377     if revs:
  2376         revs = [repo.lookup(rev) for rev in revs]
  2378         revs = [repo.lookup(rev) for rev in revs]
  3413         (bundle,
  3415         (bundle,
  3414          [('f', 'force', None,
  3416          [('f', 'force', None,
  3415            _('run even when the destination is unrelated')),
  3417            _('run even when the destination is unrelated')),
  3416           ('r', 'rev', [],
  3418           ('r', 'rev', [],
  3417            _('a changeset intended to be added to the destination')),
  3419            _('a changeset intended to be added to the destination')),
       
  3420           ('b', 'branch', [],
       
  3421            _('a specific branch you would like to bundle')),
  3418           ('', 'base', [],
  3422           ('', 'base', [],
  3419            _('a base changeset assumed to be available at the destination')),
  3423            _('a base changeset assumed to be available at the destination')),
  3420           ('a', 'all', None, _('bundle all changesets in the repository')),
  3424           ('a', 'all', None, _('bundle all changesets in the repository')),
  3421           ('t', 'type', 'bzip2', _('bundle compression type to use')),
  3425           ('t', 'type', 'bzip2', _('bundle compression type to use')),
  3422          ] + remoteopts,
  3426          ] + remoteopts,
  3434           _('the clone will include an empty working copy (only a repository)')),
  3438           _('the clone will include an empty working copy (only a repository)')),
  3435           ('u', 'updaterev', '',
  3439           ('u', 'updaterev', '',
  3436            _('revision, tag or branch to check out')),
  3440            _('revision, tag or branch to check out')),
  3437           ('r', 'rev', [],
  3441           ('r', 'rev', [],
  3438            _('include the specified changeset')),
  3442            _('include the specified changeset')),
       
  3443           ('b', 'branch', [],
       
  3444            _('clone only the specified branch')),
  3439           ('', 'pull', None, _('use pull protocol to copy metadata')),
  3445           ('', 'pull', None, _('use pull protocol to copy metadata')),
  3440           ('', 'uncompressed', None,
  3446           ('', 'uncompressed', None,
  3441            _('use uncompressed transfer (fast over LAN)')),
  3447            _('use uncompressed transfer (fast over LAN)')),
  3442          ] + remoteopts,
  3448          ] + remoteopts,
  3443          _('[OPTION]... SOURCE [DEST]')),
  3449          _('[OPTION]... SOURCE [DEST]')),
  3565            _('run even if remote repository is unrelated')),
  3571            _('run even if remote repository is unrelated')),
  3566           ('n', 'newest-first', None, _('show newest record first')),
  3572           ('n', 'newest-first', None, _('show newest record first')),
  3567           ('', 'bundle', '', _('file to store the bundles into')),
  3573           ('', 'bundle', '', _('file to store the bundles into')),
  3568           ('r', 'rev', [],
  3574           ('r', 'rev', [],
  3569            _('a remote changeset intended to be added')),
  3575            _('a remote changeset intended to be added')),
       
  3576           ('b', 'branch', [],
       
  3577            _('a specific branch you would like to pull')),
  3570          ] + logopts + remoteopts,
  3578          ] + logopts + remoteopts,
  3571          _('[-p] [-n] [-M] [-f] [-r REV]...'
  3579          _('[-p] [-n] [-M] [-f] [-r REV]...'
  3572            ' [--bundle FILENAME] [SOURCE]')),
  3580            ' [--bundle FILENAME] [SOURCE]')),
  3573     "^init":
  3581     "^init":
  3574         (init,
  3582         (init,
  3619          [('f', 'force', None,
  3627          [('f', 'force', None,
  3620            _('run even when the destination is unrelated')),
  3628            _('run even when the destination is unrelated')),
  3621           ('r', 'rev', [],
  3629           ('r', 'rev', [],
  3622            _('a changeset intended to be included in the destination')),
  3630            _('a changeset intended to be included in the destination')),
  3623           ('n', 'newest-first', None, _('show newest record first')),
  3631           ('n', 'newest-first', None, _('show newest record first')),
       
  3632           ('b', 'branch', [],
       
  3633            _('a specific branch you would like to push')),
  3624          ] + logopts + remoteopts,
  3634          ] + logopts + remoteopts,
  3625          _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
  3635          _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
  3626     "parents":
  3636     "parents":
  3627         (parents,
  3637         (parents,
  3628          [('r', 'rev', '', _('show parents of the specified revision')),
  3638          [('r', 'rev', '', _('show parents of the specified revision')),
  3635            _('update to new branch head if changesets were pulled')),
  3645            _('update to new branch head if changesets were pulled')),
  3636           ('f', 'force', None,
  3646           ('f', 'force', None,
  3637            _('run even when remote repository is unrelated')),
  3647            _('run even when remote repository is unrelated')),
  3638           ('r', 'rev', [],
  3648           ('r', 'rev', [],
  3639            _('a remote changeset intended to be added')),
  3649            _('a remote changeset intended to be added')),
       
  3650           ('b', 'branch', [],
       
  3651            _('a specific branch you would like to pull')),
  3640          ] + remoteopts,
  3652          ] + remoteopts,
  3641          _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
  3653          _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
  3642     "^push":
  3654     "^push":
  3643         (push,
  3655         (push,
  3644          [('f', 'force', None, _('force push')),
  3656          [('f', 'force', None, _('force push')),
  3645           ('r', 'rev', [],
  3657           ('r', 'rev', [],
  3646            _('a changeset intended to be included in the destination')),
  3658            _('a changeset intended to be included in the destination')),
       
  3659           ('b', 'branch', [],
       
  3660            _('a specific branch you would like to push')),
  3647          ] + remoteopts,
  3661          ] + remoteopts,
  3648          _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')),
  3662          _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')),
  3649     "recover": (recover, []),
  3663     "recover": (recover, []),
  3650     "^remove|rm":
  3664     "^remove|rm":
  3651         (remove,
  3665         (remove,