mercurial/subrepo.py
changeset 15708 309e49491253
parent 15614 260a6449d83a
child 15735 5b384b7f48d5
equal deleted inserted replaced
15707:dc3eefe0c80e 15708:309e49491253
   301 
   301 
   302     def merge(self, state):
   302     def merge(self, state):
   303         """merge currently-saved state with the new state."""
   303         """merge currently-saved state with the new state."""
   304         raise NotImplementedError
   304         raise NotImplementedError
   305 
   305 
   306     def push(self, force):
   306     def push(self, opts):
   307         """perform whatever action is analogous to 'hg push'
   307         """perform whatever action is analogous to 'hg push'
   308 
   308 
   309         This may be a no-op on some systems.
   309         This may be a no-op on some systems.
   310         """
   310         """
   311         raise NotImplementedError
   311         raise NotImplementedError
   517             else:
   517             else:
   518                 mergefunc()
   518                 mergefunc()
   519         else:
   519         else:
   520             mergefunc()
   520             mergefunc()
   521 
   521 
   522     def push(self, force):
   522     def push(self, opts):
       
   523         force = opts.get('force')
       
   524         newbranch = opts.get('new_branch')
       
   525         ssh = opts.get('ssh')
       
   526 
   523         # push subrepos depth-first for coherent ordering
   527         # push subrepos depth-first for coherent ordering
   524         c = self._repo['']
   528         c = self._repo['']
   525         subs = c.substate # only repos that are committed
   529         subs = c.substate # only repos that are committed
   526         for s in sorted(subs):
   530         for s in sorted(subs):
   527             if not c.sub(s).push(force):
   531             if not c.sub(s).push(opts):
   528                 return False
   532                 return False
   529 
   533 
   530         dsturl = _abssource(self._repo, True)
   534         dsturl = _abssource(self._repo, True)
   531         self._repo.ui.status(_('pushing subrepo %s to %s\n') %
   535         self._repo.ui.status(_('pushing subrepo %s to %s\n') %
   532             (subrelpath(self), dsturl))
   536             (subrelpath(self), dsturl))
   533         other = hg.peer(self._repo.ui, {}, dsturl)
   537         other = hg.peer(self._repo.ui, {'ssh': ssh}, dsturl)
   534         return self._repo.push(other, force)
   538         return self._repo.push(other, force, newbranch=newbranch)
   535 
   539 
   536     def outgoing(self, ui, dest, opts):
   540     def outgoing(self, ui, dest, opts):
   537         return hg.outgoing(ui, self._repo, _abssource(self._repo, True), opts)
   541         return hg.outgoing(ui, self._repo, _abssource(self._repo, True), opts)
   538 
   542 
   539     def incoming(self, ui, source, opts):
   543     def incoming(self, ui, source, opts):
   729         if new != self._wcrev():
   733         if new != self._wcrev():
   730             dirty = old == self._wcrev() or self._wcchanged()[0]
   734             dirty = old == self._wcrev() or self._wcchanged()[0]
   731             if _updateprompt(self._ui, self, dirty, self._wcrev(), new):
   735             if _updateprompt(self._ui, self, dirty, self._wcrev(), new):
   732                 self.get(state, False)
   736                 self.get(state, False)
   733 
   737 
   734     def push(self, force):
   738     def push(self, opts):
   735         # push is a no-op for SVN
   739         # push is a no-op for SVN
   736         return True
   740         return True
   737 
   741 
   738     def files(self):
   742     def files(self):
   739         output = self._svncommand(['list'])
   743         output = self._svncommand(['list'])
  1023                                  self._state[1][:7], revision[:7]):
  1027                                  self._state[1][:7], revision[:7]):
  1024                     mergefunc()
  1028                     mergefunc()
  1025         else:
  1029         else:
  1026             mergefunc()
  1030             mergefunc()
  1027 
  1031 
  1028     def push(self, force):
  1032     def push(self, opts):
       
  1033         force = opts.get('force')
       
  1034 
  1029         if not self._state[1]:
  1035         if not self._state[1]:
  1030             return True
  1036             return True
  1031         if self._gitmissing():
  1037         if self._gitmissing():
  1032             raise util.Abort(_("subrepo %s is missing") % self._relpath)
  1038             raise util.Abort(_("subrepo %s is missing") % self._relpath)
  1033         # if a branch in origin contains the revision, nothing to do
  1039         # if a branch in origin contains the revision, nothing to do