diff mercurial/commands.py @ 1959:d53a18f592be

add -f/--force to pull, incoming, outgoing, to work on unrelated repo. before this, push would not push from e.g. "hg" repo to "kernel" repo but other commands worked. this was bad idea, could merge unrelated projects by accident. i did this tonight. now, all commands still work with unrelated repo but need --force/-f. abort is default. this is safer.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Tue, 14 Mar 2006 22:58:14 -0800
parents ebe273a16048
children 62aa1b90414f
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Mar 14 22:02:41 2006 -0800
+++ b/mercurial/commands.py	Tue Mar 14 22:58:14 2006 -0800
@@ -862,7 +862,7 @@
     """
     dest = ui.expandpath(dest)
     other = hg.repository(ui, dest)
-    o = repo.findoutgoing(other)
+    o = repo.findoutgoing(other, force=opts['force'])
     cg = repo.changegroup(o, 'bundle')
     write_bundle(cg, fname)
 
@@ -1766,7 +1766,7 @@
     """
     source = ui.expandpath(source)
     other = hg.repository(ui, source)
-    incoming = repo.findincoming(other)
+    incoming = repo.findincoming(other, force=opts["force"])
     if not incoming:
         return
 
@@ -1978,7 +1978,7 @@
     """
     dest = ui.expandpath(dest)
     other = hg.repository(ui, dest)
-    o = repo.findoutgoing(other)
+    o = repo.findoutgoing(other, force=opts['force'])
     o = repo.changelog.nodesbetween(o)[0]
     if opts['newest_first']:
         o.reverse()
@@ -2066,7 +2066,7 @@
         raise util.Abort(_("pull -r doesn't work for remote repositories yet"))
     elif opts['rev']:
         revs = [other.lookup(rev) for rev in opts['rev']]
-    r = repo.pull(other, heads=revs)
+    r = repo.pull(other, heads=revs, force=opts['force'])
     if not r:
         if opts['update']:
             return update(ui, repo)
@@ -2646,7 +2646,8 @@
          _('hg annotate [-r REV] [-a] [-u] [-d] [-n] [-c] FILE...')),
     "bundle":
         (bundle,
-         [],
+         [('f', 'force', None,
+           _('run even when remote repository is unrelated'))],
          _('hg bundle FILE DEST')),
     "cat":
         (cat,
@@ -2757,6 +2758,8 @@
          _('hg import [-p NUM] [-b BASE] [-f] PATCH...')),
     "incoming|in": (incoming,
          [('M', 'no-merges', None, _('do not show merges')),
+          ('f', 'force', None,
+           _('run even when remote repository is unrelated')),
           ('', 'style', '', _('display using template map file')),
           ('n', 'newest-first', None, _('show newest record first')),
           ('', 'bundle', '', _('file to store the bundles into')),
@@ -2791,6 +2794,8 @@
     "manifest": (manifest, [], _('hg manifest [REV]')),
     "outgoing|out": (outgoing,
          [('M', 'no-merges', None, _('do not show merges')),
+          ('f', 'force', None,
+           _('run even when remote repository is unrelated')),
           ('p', 'patch', None, _('show patch')),
           ('', 'style', '', _('display using template map file')),
           ('n', 'newest-first', None, _('show newest record first')),
@@ -2808,6 +2813,8 @@
          [('u', 'update', None,
            _('update the working directory to tip after pull')),
           ('e', 'ssh', '', _('specify ssh command to use')),
+          ('f', 'force', None,
+           _('run even when remote repository is unrelated')),
           ('r', 'rev', [], _('a specific revision you would like to pull')),
           ('', 'remotecmd', '',
            _('specify hg command to run on the remote side'))],