changeset 982:ea8ef4dd967e

Merge with stable.
author Augie Fackler <raf@durin42.com>
date Sun, 11 Nov 2012 15:31:52 -0600
parents 82bbb3428684 (diff) 9ffa1daf7b08 (current diff)
children 0ba09ecf5df2
files hgsubversion/wrappers.py
diffstat 5 files changed, 41 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/editor.py
+++ b/hgsubversion/editor.py
@@ -570,13 +570,16 @@ class HgEditor(svnwrap.Editor):
 
                     msg += _TXDELT_WINDOW_HANDLER_FAILURE_MSG
                     e.args = (msg,) + others
-                    raise e
+
+                    # re-raising ensures that we show the full stack trace
+                    raise
 
                 # window being None means commit this file
                 if not window:
                     self._openfiles[file_baton] = (
                         path, target, isexec, islink, copypath)
             except svnwrap.SubversionException, e: # pragma: no cover
+                self.ui.traceback()
                 if e.args[1] == svnwrap.ERR_INCOMPLETE_DATA:
                     self.addmissing(path)
                 else: # pragma: no cover
--- a/hgsubversion/maps.py
+++ b/hgsubversion/maps.py
@@ -45,7 +45,7 @@ class AuthorMap(dict):
         if path != self.path:
             writing = open(self.path, 'a')
 
-        self.ui.note('reading authormap from %s\n' % path)
+        self.ui.debug('reading authormap from %s\n' % path)
         f = open(path, 'r')
         for number, line_org in enumerate(f):
 
@@ -88,7 +88,7 @@ class AuthorMap(dict):
         elif self.ui.configbool('hgsubversion', 'defaultauthors', True):
             self[author] = result = '%s%s' % (author, self.defaulthost)
             msg = 'substituting author "%s" for default "%s"\n'
-            self.ui.note(msg % (author, result))
+            self.ui.debug(msg % (author, result))
         else:
             msg = 'author %s has no entry in the author map!'
             raise hgutil.Abort(msg % author)
@@ -333,7 +333,7 @@ class FileMap(object):
             f.close()
 
     def load(self, fn):
-        self.ui.note('reading file map from %s\n' % fn)
+        self.ui.debug('reading file map from %s\n' % fn)
         f = open(fn, 'r')
         self.load_fd(f, fn)
         f.close()
@@ -355,7 +355,7 @@ class FileMap(object):
                 self.ui.warn(msg % (fn, line.rstrip()))
 
     def _load(self):
-        self.ui.note('reading in-repo file map from %s\n' % self.path)
+        self.ui.debug('reading in-repo file map from %s\n' % self.path)
         f = open(self.path)
         ver = int(f.readline())
         if ver != self.VERSION:
@@ -394,7 +394,7 @@ class BranchMap(dict):
         if path != self.path:
             writing = open(self.path, 'a')
 
-        self.ui.note('reading branchmap from %s\n' % path)
+        self.ui.debug('reading branchmap from %s\n' % path)
         f = open(path, 'r')
         for number, line in enumerate(f):
 
@@ -456,7 +456,7 @@ class TagMap(dict):
         if path != self.path:
             writing = open(self.path, 'a')
 
-        self.ui.note('reading tag renames from %s\n' % path)
+        self.ui.debug('reading tag renames from %s\n' % path)
         f = open(path, 'r')
         for number, line in enumerate(f):
 
--- a/hgsubversion/svnwrap/subvertpy_wrapper.py
+++ b/hgsubversion/svnwrap/subvertpy_wrapper.py
@@ -95,7 +95,7 @@ class PathAdapter(object):
         if self.copyfrom_path:
             self.copyfrom_path = intern(self.copyfrom_path)
 
-class AbstractEditor(object):
+class BaseEditor(object):
     __slots__ = ('editor', 'baton')
 
     def __init__(self, editor, baton=None):
@@ -116,7 +116,9 @@ class AbstractEditor(object):
     def close(self):
         del self.editor
 
-class FileEditor(AbstractEditor):
+class FileEditor(BaseEditor):
+    __slots__ = ()
+
     def __init__(self, editor, baton):
         super(FileEditor, self).__init__(editor, baton)
 
@@ -130,7 +132,9 @@ class FileEditor(AbstractEditor):
         self.editor.close_file(self.baton, checksum)
         super(FileEditor, self).close()
 
-class DirectoryEditor(AbstractEditor):
+class DirectoryEditor(BaseEditor):
+    __slots__ = ()
+
     def __init__(self, editor, baton):
         super(DirectoryEditor, self).__init__(editor, baton)
 
@@ -461,7 +465,7 @@ class SubversionRepo(object):
     def get_replay(self, revision, editor, oldestrev=0):
 
         try:
-            self.remote.replay(revision, oldestrev, AbstractEditor(editor))
+            self.remote.replay(revision, oldestrev, BaseEditor(editor))
         except (SubversionException, NotImplementedError), e: # pragma: no cover
             # can I depend on this number being constant?
             if (isinstance(e, NotImplementedError) or
@@ -476,7 +480,7 @@ class SubversionRepo(object):
     def get_revision(self, revision, editor):
         ''' feed the contents of the given revision to the given editor '''
         reporter = self.remote.do_update(revision, '', True,
-                                         AbstractEditor(editor))
+                                         BaseEditor(editor))
         reporter.set_path('', revision, True)
         reporter.finish()
 
--- a/hgsubversion/verify.py
+++ b/hgsubversion/verify.py
@@ -1,3 +1,4 @@
+import difflib
 import posixpath
 
 from mercurial import util as hgutil
@@ -38,6 +39,18 @@ def verify(ui, repo, args=None, **opts):
 
     ui.write('verifying %s against %s@%i\n' % (ctx, branchurl, srev))
 
+    def diff_file(path, svndata):
+        fctx = ctx[path]
+
+        if ui.verbose and not fctx.isbinary():
+            svndesc = '%s/%s/%s@%d' % (svn.svn_url, branchpath, path, srev)
+            hgdesc = '%s@%s' % (path, ctx)
+
+            for c in difflib.unified_diff(svndata.splitlines(True),
+                                          fctx.data().splitlines(True),
+                                          svndesc, hgdesc):
+                ui.note(c)
+
     if opts.get('stupid', ui.configbool('hgsubversion', 'stupid')):
         svnfiles = set()
         result = 0
@@ -62,6 +75,7 @@ def verify(ui, repo, args=None, **opts):
                 continue
             if not fctx.data() == data:
                 ui.write('difference in: %s\n' % fn)
+                diff_file(fn, data)
                 result = 1
             if not fctx.flags() == mode:
                 ui.write('wrong flags for: %s\n' % fn)
@@ -154,6 +168,7 @@ def verify(ui, repo, args=None, **opts):
 
                     if hgdata != svndata:
                         self.ui.warn('difference in: %s\n' % self.file)
+                        diff_file(self.file, svndata)
                         self.failed = True
 
                 if self.file is not None:
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -375,12 +375,10 @@ def pull(repo, source, heads=[], force=F
             # start converting revisions
             firstrun = True
             for r in svn.revisions(start=start, stop=stopat_rev):
-                if r.revnum in skiprevs:
-                    ui.status('[r%d SKIPPED]\n' % r.revnum)
-                    continue
-                lastpulled = r.revnum
-                if (r.author is None and
-                    r.message == 'This is an empty revision for padding.'):
+                if (r.revnum in skiprevs or
+                    (r.author is None and
+                     r.message == 'This is an empty revision for padding.')):
+                    lastpulled = r.revnum
                     continue
                 tbdelta = meta.update_branch_tag_map_for_rev(r)
                 # got a 502? Try more than once!
@@ -429,6 +427,9 @@ def pull(repo, source, heads=[], force=F
                         else:
                             ui.traceback()
                             raise hgutil.Abort(*e.args)
+
+                lastpulled = r.revnum
+
         except KeyboardInterrupt:
             ui.traceback()
     finally: