Commits

Stefan Rusek committed 6bde659

Add support for --outgoing and --force parameters
Allow --outgoing to have a repo parameter

  • Participants
  • Parent commits 5336dd2

Comments (0)

Files changed (1)

 from mercurial import repair
 from mercurial import patch
 from mercurial import util
+from mercurial import url
 from mercurial.i18n import _
 
 # almost entirely stolen from the git-rebase--interactive.sh source
 def histedit(ui, repo, *parent, **opts):
     """hg histedit <parent>
     """
+    if opts.get('outgoing'):
+        if len(parent) > 1:
+            raise util.Abort('only one repo argument allowed with --outgoing')
+        elif parent:
+            parent = parent[0]
+
+        dest, revs, checkout = hg.parseurl(
+            ui.expandpath(parent or 'default-push', parent or 'default'), ['tip'])
+        cmdutil.setremoteconfig(ui, opts)
+        if revs:
+            revs = [repo.lookup(rev) for rev in revs]
+
+        other = hg.repository(ui, dest)
+        ui.status(_('comparing with %s\n') % url.hidepassword(dest))
+        parent = repo.findoutgoing(other, force=opts.get('force'))
+    else:
+        if opts.get('force'):
+            raise util.Abort('--force only allowed with --outgoing')
+
     if opts.get('continue', False):
         if len(parent) != 0:
             raise util.Abort('no arguments allowed with --continue')
          [('c', 'continue', False, 'continue an edit already in progress', ),
           ('k', 'keep', False, 'strip old nodes after edit is complete', ),
           ('', 'abort', False, 'abort an edit in progress', ),
+          ('o', 'outgoing', False, 'changesets not found in destination'),
+          ('f', 'force', False, 'force outgoing even for unrelated repositories'),
           ],
          __doc__,
          ),