changeset 13334:2b2155623ee2 stable 1.7.5

merge with crew
author Matt Mackall <mpm@selenic.com>
date Tue, 01 Feb 2011 17:29:38 -0600
parents 927e3940bfc3 (diff) c10e168cbee2 (current diff)
children 36f5fc742a5a
files
diffstat 11 files changed, 110 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/doc/hgrc.5.txt	Tue Feb 01 17:08:49 2011 -0600
+++ b/doc/hgrc.5.txt	Tue Feb 01 17:29:38 2011 -0600
@@ -1030,6 +1030,9 @@
     You can use OpenSSL's CA certificate file if your platform has one.
     On most Linux systems this will be ``/etc/ssl/certs/ca-certificates.crt``.
     Otherwise you will have to generate this file manually.
+
+    To disable SSL verification temporarily, specify ``--insecure`` from
+    command line.
 ``contact``
     Name or email address of the person in charge of the repository.
     Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty.
--- a/hgext/win32mbcs.py	Tue Feb 01 17:08:49 2011 -0600
+++ b/hgext/win32mbcs.py	Tue Feb 01 17:29:38 2011 -0600
@@ -34,7 +34,7 @@
 
 - You should use single encoding in one repository.
 - If the repository path ends with 0x5c, .hg/hgrc cannot be read.
-- win32mbcs is not compatible with fixutf8 extention.
+- win32mbcs is not compatible with fixutf8 extension.
 
 By default, win32mbcs uses encoding.encoding decided by Mercurial.
 You can specify the encoding by config option::
--- a/mercurial/commands.py	Tue Feb 01 17:08:49 2011 -0600
+++ b/mercurial/commands.py	Tue Feb 01 17:29:38 2011 -0600
@@ -3943,6 +3943,8 @@
      _('specify ssh command to use'), _('CMD')),
     ('', 'remotecmd', '',
      _('specify hg command to run on the remote side'), _('CMD')),
+    ('', 'insecure', None,
+     _('do not verify server certificate (ignoring web.cacerts config)')),
 ]
 
 walkopts = [
--- a/mercurial/dispatch.py	Tue Feb 01 17:08:49 2011 -0600
+++ b/mercurial/dispatch.py	Tue Feb 01 17:29:38 2011 -0600
@@ -552,6 +552,9 @@
     if options['noninteractive']:
         ui.setconfig('ui', 'interactive', 'off')
 
+    if cmdoptions.get('insecure', False):
+        ui.setconfig('web', 'cacerts', '')
+
     if options['help']:
         return commands.help_(ui, cmd, options['version'])
     elif options['version']:
--- a/mercurial/merge.py	Tue Feb 01 17:08:49 2011 -0600
+++ b/mercurial/merge.py	Tue Feb 01 17:29:38 2011 -0600
@@ -249,7 +249,7 @@
 def actionkey(a):
     return a[1] == 'r' and -1 or 0, a
 
-def applyupdates(repo, action, wctx, mctx, actx):
+def applyupdates(repo, action, wctx, mctx, actx, overwrite):
     """apply the merge action list to the working directory
 
     wctx is the working copy context
@@ -307,7 +307,7 @@
             repo.ui.note(_("removing %s\n") % f)
             audit_path(f)
             if f == '.hgsubstate': # subrepo states need updating
-                subrepo.submerge(repo, wctx, mctx, wctx)
+                subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
             try:
                 util.unlink(repo.wjoin(f))
             except OSError, inst:
@@ -317,7 +317,7 @@
             removed += 1
         elif m == "m": # merge
             if f == '.hgsubstate': # subrepo states need updating
-                subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx))
+                subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), overwrite)
                 continue
             f2, fd, flags, move = a[2:]
             r = ms.resolve(fd, wctx, mctx)
@@ -340,7 +340,7 @@
             t = None
             updated += 1
             if f == '.hgsubstate': # subrepo states need updating
-                subrepo.submerge(repo, wctx, mctx, wctx)
+                subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
         elif m == "d": # directory rename
             f2, fd, flags = a[2:]
             if f:
@@ -529,7 +529,7 @@
         if not partial:
             repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
 
-        stats = applyupdates(repo, action, wc, p2, pa)
+        stats = applyupdates(repo, action, wc, p2, pa, overwrite)
 
         if not partial:
             repo.dirstate.setparents(fp1, fp2)
--- a/mercurial/subrepo.py	Tue Feb 01 17:08:49 2011 -0600
+++ b/mercurial/subrepo.py	Tue Feb 01 17:29:38 2011 -0600
@@ -82,7 +82,7 @@
                 ''.join(['%s %s\n' % (state[s][1], s)
                          for s in sorted(state)]), '')
 
-def submerge(repo, wctx, mctx, actx):
+def submerge(repo, wctx, mctx, actx, overwrite):
     """delegated from merge.applyupdates: merging of .hgsubstate file
     in working context, merging context and ancestor context"""
     if mctx == actx: # backwards?
@@ -114,7 +114,7 @@
                 continue
             elif ld == a: # other side changed
                 debug(s, "other changed, get", r)
-                wctx.sub(s).get(r)
+                wctx.sub(s).get(r, overwrite)
                 sm[s] = r
             elif ld[0] != r[0]: # sources differ
                 if repo.ui.promptchoice(
@@ -123,11 +123,11 @@
                       % (s, l[0], r[0]),
                       (_('&Local'), _('&Remote')), 0):
                     debug(s, "prompt changed, get", r)
-                    wctx.sub(s).get(r)
+                    wctx.sub(s).get(r, overwrite)
                     sm[s] = r
             elif ld[1] == a[1]: # local side is unchanged
                 debug(s, "other side changed, get", r)
-                wctx.sub(s).get(r)
+                wctx.sub(s).get(r, overwrite)
                 sm[s] = r
             else:
                 debug(s, "both sides changed, merge with", r)
@@ -260,13 +260,13 @@
         """
         raise NotImplementedError
 
-    def get(self, state):
+    def get(self, state, overwrite=False):
         """run whatever commands are needed to put the subrepo into
         this state
         """
         raise NotImplementedError
 
-    def merge(self, state):
+    def merge(self, state, overwrite=False):
         """merge currently-saved state with the new state."""
         raise NotImplementedError
 
@@ -419,7 +419,7 @@
             other = hg.repository(self._repo.ui, srcurl)
             self._repo.pull(other)
 
-    def get(self, state):
+    def get(self, state, overwrite=False):
         self._get(state)
         source, revision, kind = state
         self._repo.ui.debug("getting subrepo %s\n" % self._path)
@@ -589,7 +589,9 @@
         except OSError:
             pass
 
-    def get(self, state):
+    def get(self, state, overwrite=False):
+        if overwrite:
+            self._svncommand(['revert', '--recursive'])
         status = self._svncommand(['checkout', state[0], '--revision', state[1]])
         if not re.search('Checked out revision [0-9]+.', status):
             raise util.Abort(status.splitlines()[-1])
--- a/mercurial/url.py	Tue Feb 01 17:08:49 2011 -0600
+++ b/mercurial/url.py	Tue Feb 01 17:29:38 2011 -0600
@@ -541,8 +541,9 @@
                         ca_certs=cacerts)
                 msg = _verifycert(self.sock.getpeercert(), self.host)
                 if msg:
-                    raise util.Abort(_('%s certificate error: %s') %
-                                     (self.host, msg))
+                    raise util.Abort(_('%s certificate error: %s '
+                                       '(use --insecure to connect '
+                                       'insecurely)') % (self.host, msg))
                 self.ui.debug('%s certificate successfully verified\n' %
                               self.host)
             else:
--- a/tests/test-debugcomplete.t	Tue Feb 01 17:08:49 2011 -0600
+++ b/tests/test-debugcomplete.t	Tue Feb 01 17:29:38 2011 -0600
@@ -179,16 +179,16 @@
   $ hg debugcommands
   add: include, exclude, subrepos, dry-run
   annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, include, exclude
-  clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd
+  clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure
   commit: addremove, close-branch, include, exclude, message, logfile, date, user
   diff: rev, change, text, git, nodates, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude, subrepos
   export: output, switch-parent, rev, text, git, nodates
   forget: include, exclude
-  init: ssh, remotecmd
+  init: ssh, remotecmd, insecure
   log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, style, template, include, exclude
   merge: force, tool, rev, preview
-  pull: update, force, rev, branch, ssh, remotecmd
-  push: force, rev, branch, new-branch, ssh, remotecmd
+  pull: update, force, rev, branch, ssh, remotecmd, insecure
+  push: force, rev, branch, new-branch, ssh, remotecmd, insecure
   remove: after, force, include, exclude
   serve: accesslog, daemon, daemon-pipefds, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, templates, style, ipv6, certificate
   status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos
@@ -200,7 +200,7 @@
   bisect: reset, good, bad, skip, command, noupdate
   branch: force, clean
   branches: active, closed
-  bundle: force, rev, branch, base, all, type, ssh, remotecmd
+  bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
   cat: output, rev, decode, include, exclude
   copy: after, force, include, exclude, dry-run
   debugancestor: 
@@ -228,10 +228,10 @@
   help: 
   identify: rev, num, id, branch, tags
   import: strip, base, force, no-commit, exact, import-branch, message, logfile, date, user, similarity
-  incoming: force, newest-first, bundle, rev, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, subrepos
+  incoming: force, newest-first, bundle, rev, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
   locate: rev, print0, fullpath, include, exclude
   manifest: rev
-  outgoing: force, rev, newest-first, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, subrepos
+  outgoing: force, rev, newest-first, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
   parents: rev, style, template
   paths: 
   recover: 
--- a/tests/test-https.t	Tue Feb 01 17:08:49 2011 -0600
+++ b/tests/test-https.t	Tue Feb 01 17:29:38 2011 -0600
@@ -163,15 +163,30 @@
   pulling from https://localhost:$HGPORT/
   searching for changes
   no changes found
+  $ P=`pwd` hg -R copy-pull pull --insecure
+  warning: localhost certificate with fingerprint 91:4f:1a:ff:87:24:9c:09:b6:85:9b:88:b1:90:6d:30:75:64:91:ca not verified (check hostfingerprints or web.cacerts config setting)
+  pulling from https://localhost:$HGPORT/
+  searching for changes
+  no changes found
 
 cacert mismatch
 
   $ hg -R copy-pull pull --config web.cacerts=pub.pem https://127.0.0.1:$HGPORT/
-  abort: 127.0.0.1 certificate error: certificate is for localhost
+  abort: 127.0.0.1 certificate error: certificate is for localhost (use --insecure to connect insecurely)
   [255]
+  $ hg -R copy-pull pull --config web.cacerts=pub.pem https://127.0.0.1:$HGPORT/ --insecure
+  warning: 127.0.0.1 certificate with fingerprint 91:4f:1a:ff:87:24:9c:09:b6:85:9b:88:b1:90:6d:30:75:64:91:ca not verified (check hostfingerprints or web.cacerts config setting)
+  pulling from https://127.0.0.1:$HGPORT/
+  searching for changes
+  no changes found
   $ hg -R copy-pull pull --config web.cacerts=pub-other.pem
   abort: error: *:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (glob)
   [255]
+  $ hg -R copy-pull pull --config web.cacerts=pub-other.pem --insecure
+  warning: localhost certificate with fingerprint 91:4f:1a:ff:87:24:9c:09:b6:85:9b:88:b1:90:6d:30:75:64:91:ca not verified (check hostfingerprints or web.cacerts config setting)
+  pulling from https://localhost:$HGPORT/
+  searching for changes
+  no changes found
 
 Test server cert which isn't valid yet
 
--- a/tests/test-subrepo-svn.t	Tue Feb 01 17:08:49 2011 -0600
+++ b/tests/test-subrepo-svn.t	Tue Feb 01 17:29:38 2011 -0600
@@ -264,3 +264,35 @@
   $ hg up null
   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
   $ ls
+
+Check hg update --clean
+  $ cd $TESTTMP/sub/t
+  $ cd s
+  $ echo c0 > alpha
+  $ echo c1 > f1
+  $ echo c1 > f2
+  $ svn add f1 -q
+  $ svn status
+  ?       a
+  X       externals
+  ?       f2
+  M       alpha
+  A       f1
+  
+  Performing status on external item at 'externals'
+  $ cd ../..
+  $ hg -R t update -C
+  
+  Fetching external item into 't/s/externals'
+  Checked out external at revision 1.
+  
+  Checked out revision 3.
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd t/s
+  $ svn status
+  ?       a
+  X       externals
+  ?       f1
+  ?       f2
+  
+  Performing status on external item at 'externals'
--- a/tests/test-subrepo.t	Tue Feb 01 17:08:49 2011 -0600
+++ b/tests/test-subrepo.t	Tue Feb 01 17:29:38 2011 -0600
@@ -675,3 +675,31 @@
   committing subrepository subrepo-1
   committing subrepository subrepo-2
   $ hg st subrepo-2/file
+
+Check hg update --clean
+  $ cd $TESTTMP/sub/t
+  $ rm -r t/t.orig
+  $ hg status -S --all
+  C .hgsub
+  C .hgsubstate
+  C a
+  C s/.hgsub
+  C s/.hgsubstate
+  C s/a
+  C s/ss/a
+  C t/t
+  $ echo c1 > s/a
+  $ cd s
+  $ echo c1 > b
+  $ echo c1 > c
+  $ hg add b
+  $ cd ..
+  $ hg status -S
+  M s/a
+  A s/b
+  ? s/c
+  $ hg update -C
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg status -S
+  ? s/b
+  ? s/c