diff hgext/largefiles/overrides.py @ 26587:56b2bcea2529

error: get Abort from 'error' instead of 'util' The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be confused about that and gives all the credit to 'util' instead of the hardworking 'error'. In a spirit of equity, we break the cycle of injustice and give back to 'error' the respect it deserves. And screw that 'util' poser. For great justice.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 08 Oct 2015 12:55:45 -0700
parents 97dc6ab42aad
children 2a405d307f8c
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Mon Oct 05 22:49:24 2015 -0700
+++ b/hgext/largefiles/overrides.py	Thu Oct 08 12:55:45 2015 -0700
@@ -12,7 +12,7 @@
 import copy
 
 from mercurial import hg, util, cmdutil, scmutil, match as match_, \
-        archival, pathutil, revset
+        archival, pathutil, revset, error
 from mercurial.i18n import _
 
 import lfutil
@@ -245,7 +245,7 @@
 
 def overrideadd(orig, ui, repo, *pats, **opts):
     if opts.get('normal') and opts.get('large'):
-        raise util.Abort(_('--normal cannot be used with --large'))
+        raise error.Abort(_('--normal cannot be used with --large'))
     return orig(ui, repo, *pats, **opts)
 
 def cmdutiladd(orig, ui, repo, matcher, prefix, explicitonly, **opts):
@@ -584,7 +584,7 @@
     installnormalfilesmatchfn(repo[None].manifest())
     try:
         result = orig(ui, repo, pats, opts, rename)
-    except util.Abort as e:
+    except error.Abort as e:
         if str(e) != _('no files to copy'):
             raise e
         else:
@@ -688,7 +688,7 @@
 
                 lfdirstate.add(destlfile)
         lfdirstate.write()
-    except util.Abort as e:
+    except error.Abort as e:
         if str(e) != _('no files to copy'):
             raise e
         else:
@@ -698,7 +698,7 @@
         wlock.release()
 
     if nolfiles and nonormalfiles:
-        raise util.Abort(_('no files to copy'))
+        raise error.Abort(_('no files to copy'))
 
     return result
 
@@ -827,7 +827,7 @@
     try:
         firstpulled = repo.firstpulled
     except AttributeError:
-        raise util.Abort(_("pulled() only available in --lfrev"))
+        raise error.Abort(_("pulled() only available in --lfrev"))
     return revset.baseset([r for r in subset if r >= firstpulled])
 
 def overrideclone(orig, ui, source, dest=None, **opts):
@@ -835,7 +835,7 @@
     if d is None:
         d = hg.defaultdest(source)
     if opts.get('all_largefiles') and not hg.islocal(d):
-            raise util.Abort(_(
+            raise error.Abort(_(
             '--all-largefiles is incompatible with non-local destination %s') %
             d)
 
@@ -916,13 +916,13 @@
         lfcommands.cachelfiles(repo.ui, repo, node)
 
     if kind not in archival.archivers:
-        raise util.Abort(_("unknown archive type '%s'") % kind)
+        raise error.Abort(_("unknown archive type '%s'") % kind)
 
     ctx = repo[node]
 
     if kind == 'files':
         if prefix:
-            raise util.Abort(
+            raise error.Abort(
                 _('cannot give prefix when archiving to files'))
     else:
         prefix = archival.tidyprefix(dest, kind, prefix)
@@ -949,7 +949,7 @@
                 path = lfutil.findfile(repo, getdata().strip())
 
                 if path is None:
-                    raise util.Abort(
+                    raise error.Abort(
                        _('largefile %s not found in repo store or system cache')
                        % lfutil.splitstandin(f))
             else:
@@ -1006,7 +1006,7 @@
                 path = lfutil.findfile(repo._repo, getdata().strip())
 
                 if path is None:
-                    raise util.Abort(
+                    raise error.Abort(
                        _('largefile %s not found in repo store or system cache')
                        % lfutil.splitstandin(f))
             else:
@@ -1043,7 +1043,7 @@
     s = repo.status()
     repo.lfstatus = False
     if s.modified or s.added or s.removed or s.deleted:
-        raise util.Abort(_('uncommitted changes'))
+        raise error.Abort(_('uncommitted changes'))
 
 def cmdutilforget(orig, ui, repo, match, prefix, explicitonly):
     normalmatcher = composenormalfilematcher(match, repo[None].manifest())
@@ -1344,7 +1344,7 @@
                 store = basestore._openstore(repo)
                 success, missing = store.get([(lf, hash)])
                 if len(success) != 1:
-                    raise util.Abort(
+                    raise error.Abort(
                         _('largefile %s is not in cache and could not be '
                           'downloaded')  % lf)
             path = lfutil.usercachepath(repo.ui, hash)