Patchwork [7,of,8] subrepo: make the output references to subrepositories consistent

login
register
mail settings
Submitter Matt Harbison
Date July 9, 2017, 11:34 p.m.
Message ID <52be0dbe23036b919def.1499643295@Envy>
Download mbox | patch
Permalink /patch/22191/
State Accepted
Headers show

Comments

Matt Harbison - July 9, 2017, 11:34 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1499631210 14400
#      Sun Jul 09 16:13:30 2017 -0400
# Node ID 52be0dbe23036b919defce0c417175ab615a05b2
# Parent  97e2a1b90d6f74fbff1f7c62dc97b16462b9a7d2
subrepo: make the output references to subrepositories consistent

Well, mostly.  The annotation on subrepo functions tacks on a parenthetical to
the abort message, which seems reasonable for a generic mechanism.  But now all
messages consistently spell out 'subrepository', and double quote the name of
the repo.  I noticed the inconsistency in the change for the last commit.

Patch

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -73,7 +73,7 @@ 
             raise ex
         except error.Abort as ex:
             subrepo = subrelpath(self)
-            errormsg = str(ex) + ' ' + _('(in subrepo %s)') % subrepo
+            errormsg = str(ex) + ' ' + _('(in subrepository "%s")') % subrepo
             # avoid handling this exception by raising a SubrepoAbort exception
             raise SubrepoAbort(errormsg, hint=ex.hint, subrepo=subrepo,
                                cause=sys.exc_info())
@@ -147,7 +147,7 @@ 
         kind = 'hg'
         if src.startswith('['):
             if ']' not in src:
-                raise error.Abort(_('missing ] in subrepo source'))
+                raise error.Abort(_('missing ] in subrepository source'))
             kind, src = src.split(']', 1)
             kind = kind[1:]
             src = src.lstrip() # strip any extra whitespace after ']'
@@ -477,7 +477,7 @@ 
         This returns None, otherwise.
         """
         if self.dirty(ignoreupdate=ignoreupdate, missing=missing):
-            return _("uncommitted changes in subrepository '%s'"
+            return _('uncommitted changes in subrepository "%s"'
                      ) % subrelpath(self)
 
     def bailifchanged(self, ignoreupdate=False, hint=None):
@@ -896,7 +896,7 @@ 
             ctx = urepo[revision]
             if ctx.hidden():
                 urepo.ui.warn(
-                    _('revision %s in subrepo %s is hidden\n') \
+                    _('revision %s in subrepository "%s" is hidden\n') \
                     % (revision[0:12], self._path))
                 repo = urepo
         hg.updaterepo(repo, revision, overwrite)
@@ -910,12 +910,14 @@ 
 
         def mergefunc():
             if anc == cur and dst.branch() == cur.branch():
-                self.ui.debug("updating subrepo %s\n" % subrelpath(self))
+                self.ui.debug('updating subrepository "%s"\n'
+                              % subrelpath(self))
                 hg.update(self._repo, state[1])
             elif anc == dst:
-                self.ui.debug("skipping subrepo %s\n" % subrelpath(self))
+                self.ui.debug('skipping subrepository "%s"\n'
+                              % subrelpath(self))
             else:
-                self.ui.debug("merging subrepo %s\n" % subrelpath(self))
+                self.ui.debug('merging subrepository "%s"\n' % subrelpath(self))
                 hg.merge(self._repo, state[1], remind=False)
 
         wctx = self._repo[None]
@@ -1555,8 +1557,8 @@ 
         # try only origin: the originally cloned repo
         self._gitcommand(['fetch'])
         if not self._githavelocally(revision):
-            raise error.Abort(_("revision %s does not exist in subrepo %s\n") %
-                               (revision, self._relpath))
+            raise error.Abort(_('revision %s does not exist in subrepository '
+                                '"%s"\n') % (revision, self._relpath))
 
     @annotatesubrepoerror
     def dirty(self, ignoreupdate=False, missing=False):
@@ -1611,8 +1613,8 @@ 
 
         def rawcheckout():
             # no branch to checkout, check it out with no branch
-            self.ui.warn(_('checking out detached HEAD in subrepo %s\n') %
-                          self._relpath)
+            self.ui.warn(_('checking out detached HEAD in '
+                           'subrepository "%s"\n') % self._relpath)
             self.ui.warn(_('check out a git branch if you intend '
                             'to make changes\n'))
             checkout(['-q', revision])
@@ -1731,14 +1733,14 @@ 
             # determine if the current branch is even useful
             if not self._gitisancestor(self._state[1], current):
                 self.ui.warn(_('unrelated git branch checked out '
-                                'in subrepo %s\n') % self._relpath)
+                               'in subrepository "%s"\n') % self._relpath)
                 return False
-            self.ui.status(_('pushing branch %s of subrepo %s\n') %
+            self.ui.status(_('pushing branch %s of subrepository "%s"\n') %
                            (current.split('/', 2)[2], self._relpath))
             ret = self._gitdir(cmd + ['origin', current])
             return ret[1] == 0
         else:
-            self.ui.warn(_('no branch checked out in subrepo %s\n'
+            self.ui.warn(_('no branch checked out in subrepository "%s"\n'
                            'cannot push revision %s\n') %
                           (self._relpath, self._state[1]))
             return False
diff --git a/tests/test-commit.t b/tests/test-commit.t
--- a/tests/test-commit.t
+++ b/tests/test-commit.t
@@ -375,7 +375,7 @@ 
   HG: changed changed
   HG: removed removed
   ====
-  abort: precommit.test-saving-last-message hook exited with status 1 (in subrepo sub)
+  abort: precommit.test-saving-last-message hook exited with status 1 (in subrepository "sub")
   [255]
   $ cat .hg/last-message.txt
   
diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t
--- a/tests/test-largefiles-misc.t
+++ b/tests/test-largefiles-misc.t
@@ -270,7 +270,7 @@ 
   update: (current)
   phases: 3 draft
   $ hg ci -m "this commit should fail without -S"
-  abort: uncommitted changes in subrepository 'subrepo'
+  abort: uncommitted changes in subrepository "subrepo"
   (use --subrepos for recursive commit)
   [255]
 
diff --git a/tests/test-merge-subrepos.t b/tests/test-merge-subrepos.t
--- a/tests/test-merge-subrepos.t
+++ b/tests/test-merge-subrepos.t
@@ -21,7 +21,7 @@ 
 Should fail, since there are added files to subrepo:
 
   $ hg merge
-  abort: uncommitted changes in subrepository 'subrepo'
+  abort: uncommitted changes in subrepository "subrepo"
   [255]
 
 Deleted files trigger a '+' marker in top level repos.  Deleted files are also
@@ -80,7 +80,7 @@ 
   M subrepo/b
 
   $ hg up -r '.^' --check
-  abort: uncommitted changes in subrepository 'subrepo'
+  abort: uncommitted changes in subrepository "subrepo"
   [255]
 
   $ hg sum
@@ -103,7 +103,7 @@ 
 missing file in the top level repo.
 
   $ hg up -r '.^' --check
-  abort: uncommitted changes in subrepository 'subrepo'
+  abort: uncommitted changes in subrepository "subrepo"
   [255]
 
   $ hg up -r '.^' --config ui.interactive=True << EOF
@@ -126,5 +126,5 @@ 
 Merge sees deleted subrepo files as an uncommitted change
 
   $ hg merge @other
-  abort: uncommitted changes in subrepository 'subrepo'
+  abort: uncommitted changes in subrepository "subrepo"
   [255]
diff --git a/tests/test-mq-subrepo-svn.t b/tests/test-mq-subrepo-svn.t
--- a/tests/test-mq-subrepo-svn.t
+++ b/tests/test-mq-subrepo-svn.t
@@ -47,7 +47,7 @@ 
   $ cd ..
   $ hg status -S        # doesn't show status for svn subrepos (yet)
   $ hg qnew -m1 1.diff
-  abort: uncommitted changes in subrepository 'sub'
+  abort: uncommitted changes in subrepository "sub"
   [255]
 
   $ cd ..
diff --git a/tests/test-mq-subrepo.t b/tests/test-mq-subrepo.t
--- a/tests/test-mq-subrepo.t
+++ b/tests/test-mq-subrepo.t
@@ -102,7 +102,7 @@ 
   A .hgsub
   A sub/a
   % qnew -X path:no-effect -m0 0.diff
-  abort: uncommitted changes in subrepository 'sub'
+  abort: uncommitted changes in subrepository "sub"
   [255]
   % update substate when adding .hgsub w/clean updated subrepo
   A .hgsub
@@ -118,7 +118,7 @@ 
   M .hgsub
   A sub2/a
   % qnew --cwd .. -R repo-2499-qnew -X path:no-effect -m1 1.diff
-  abort: uncommitted changes in subrepository 'sub2'
+  abort: uncommitted changes in subrepository "sub2"
   [255]
   % update substate when modifying .hgsub w/clean updated subrepo
   M .hgsub
@@ -163,7 +163,7 @@ 
   A .hgsub
   A sub/a
   % qrefresh
-  abort: uncommitted changes in subrepository 'sub'
+  abort: uncommitted changes in subrepository "sub"
   [255]
   % update substate when adding .hgsub w/clean updated subrepo
   A .hgsub
@@ -180,7 +180,7 @@ 
   M .hgsub
   A sub2/a
   % qrefresh
-  abort: uncommitted changes in subrepository 'sub2'
+  abort: uncommitted changes in subrepository "sub2"
   [255]
   % update substate when modifying .hgsub w/clean updated subrepo
   M .hgsub
@@ -305,7 +305,7 @@ 
   
   warning: subrepo spec file '.hgsub' not found
   warning: subrepo spec file '.hgsub' not found
-  abort: uncommitted changes in subrepository 'sub'
+  abort: uncommitted changes in subrepository "sub"
   [255]
   % update substate when adding .hgsub w/clean updated subrepo
   A .hgsub
@@ -342,7 +342,7 @@ 
   +sub2 = sub2
   record this change to '.hgsub'? [Ynesfdaq?] y
   
-  abort: uncommitted changes in subrepository 'sub2'
+  abort: uncommitted changes in subrepository "sub2"
   [255]
   % update substate when modifying .hgsub w/clean updated subrepo
   M .hgsub
diff --git a/tests/test-rebase-pull.t b/tests/test-rebase-pull.t
--- a/tests/test-rebase-pull.t
+++ b/tests/test-rebase-pull.t
@@ -127,7 +127,7 @@ 
   $ echo a > s/a
   $ hg -R s add s/a
   $ hg pull --rebase
-  abort: uncommitted changes in subrepository 's'
+  abort: uncommitted changes in subrepository "s"
   (cannot pull with rebase: please commit or shelve your changes first)
   [255]
 
diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t
--- a/tests/test-subrepo-git.t
+++ b/tests/test-subrepo-git.t
@@ -156,7 +156,7 @@ 
 
   $ hg push 2>/dev/null
   pushing to $TESTTMP/t (glob)
-  pushing branch testing of subrepo s
+  pushing branch testing of subrepository "s"
   searching for changes
   adding changesets
   adding manifests
@@ -200,7 +200,7 @@ 
    revision f47b465e1bce645dbf37232a00574aa1546ca8d3
   $ hg push 2>/dev/null
   pushing to $TESTTMP/t (glob)
-  pushing branch testing of subrepo s
+  pushing branch testing of subrepository "s"
   searching for changes
   adding changesets
   adding manifests
@@ -224,7 +224,7 @@ 
   $ hg clone . ../td 2>&1 | egrep -v '^Cloning into|^done\.'
   updating to branch default
   cloning subrepo s from $TESTTMP/gitroot
-  checking out detached HEAD in subrepo s
+  checking out detached HEAD in subrepository "s"
   check out a git branch if you intend to make changes
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd ../td
@@ -389,10 +389,10 @@ 
   $ hg sum | grep commit
   commit: 1 subrepos
   $ hg push -q
-  abort: subrepo s is missing (in subrepo s)
+  abort: subrepo s is missing (in subrepository "s")
   [255]
   $ hg commit --subrepos -qm missing
-  abort: subrepo s is missing (in subrepo s)
+  abort: subrepo s is missing (in subrepository "s")
   [255]
 
 #if symlink
@@ -400,10 +400,10 @@ 
   $ ln -s broken s
   $ hg status -S
   $ hg push -q
-  abort: subrepo s is missing (in subrepo s)
+  abort: subrepo s is missing (in subrepository "s")
   [255]
   $ hg commit --subrepos -qm missing
-  abort: subrepo s is missing (in subrepo s)
+  abort: subrepo s is missing (in subrepository "s")
   [255]
   $ rm s
 #endif
@@ -702,7 +702,7 @@ 
   $ mkdir s/.git/.hg
   $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc
   $ hg update -q -C af6d2edbb0d3
-  checking out detached HEAD in subrepo s
+  checking out detached HEAD in subrepository "s"
   check out a git branch if you intend to make changes
 
 check differences made by most recent change
@@ -1160,7 +1160,7 @@ 
   fatal: transport 'ext' not allowed
   updating to branch default
   cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt
-  abort: git clone error 128 in s (in subrepo s)
+  abort: git clone error 128 in s (in subrepository "s")
   [255]
   $ f -Dq pwned.txt
   pwned.txt: file not found
@@ -1176,7 +1176,7 @@ 
   and the repository exists.
   updating to branch default
   cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt
-  abort: git clone error 128 in s (in subrepo s)
+  abort: git clone error 128 in s (in subrepository "s")
   [255]
   $ f -Dq pwned.txt
   pwned: you asked for it
diff --git a/tests/test-subrepo-missing.t b/tests/test-subrepo-missing.t
--- a/tests/test-subrepo-missing.t
+++ b/tests/test-subrepo-missing.t
@@ -92,7 +92,7 @@ 
   $ hg commit --amend -m "addb (amended)"
   $ cd ..
   $ hg update --clean .
-  revision 102a90ea7b4a in subrepo subrepo is hidden
+  revision 102a90ea7b4a in subrepository "subrepo" is hidden
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 check that --hidden is propagated to the subrepo
diff --git a/tests/test-subrepo-recursion.t b/tests/test-subrepo-recursion.t
--- a/tests/test-subrepo-recursion.t
+++ b/tests/test-subrepo-recursion.t
@@ -59,7 +59,7 @@ 
 Commits:
 
   $ hg commit -m fails
-  abort: uncommitted changes in subrepository 'foo'
+  abort: uncommitted changes in subrepository "foo"
   (use --subrepos for recursive commit)
   [255]
 
@@ -495,7 +495,7 @@ 
   $ echo f > foo/f
   $ hg archive --subrepos -r tip archive
   cloning subrepo foo from $TESTTMP/empty/foo
-  abort: destination '$TESTTMP/almost-empty/foo' is not empty (in subrepo foo) (glob)
+  abort: destination '$TESTTMP/almost-empty/foo' is not empty (in subrepository "foo") (glob)
   [255]
 
 Clone and test outgoing:
diff --git a/tests/test-subrepo-svn.t b/tests/test-subrepo-svn.t
--- a/tests/test-subrepo-svn.t
+++ b/tests/test-subrepo-svn.t
@@ -113,7 +113,7 @@ 
   $ rm s/alpha
   $ hg commit --subrepos -m 'abort on missing file'
   committing subrepository s
-  abort: cannot commit missing svn entries (in subrepo s)
+  abort: cannot commit missing svn entries (in subrepository "s")
   [255]
   $ svn revert s/alpha > /dev/null
 
@@ -170,7 +170,7 @@ 
   $ echo zzz > s/externals/other
   $ hg ci --subrepos -m 'amend externals from hg'
   committing subrepository s
-  abort: cannot commit svn externals (in subrepo s)
+  abort: cannot commit svn externals (in subrepository "s")
   [255]
   $ hg diff --subrepos -r 1:2 | grep -v diff
   --- a/.hgsubstate	Thu Jan 01 00:00:00 1970 +0000
@@ -192,7 +192,7 @@ 
   property 'svn:mime-type' set on 's/externals/other' (glob)
   $ hg ci --subrepos -m 'amend externals from hg'
   committing subrepository s
-  abort: cannot commit svn externals (in subrepo s)
+  abort: cannot commit svn externals (in subrepository "s")
   [255]
   $ svn revert -q s/externals/other
 
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -111,7 +111,7 @@ 
 
   $ echo b >> s/a
   $ hg backout tip
-  abort: uncommitted changes in subrepository 's'
+  abort: uncommitted changes in subrepository "s"
   [255]
   $ hg revert -C -R s s/a
 
@@ -163,7 +163,7 @@ 
 
   $ echo c > s/a
   $ hg --config ui.commitsubrepos=no ci -m4
-  abort: uncommitted changes in subrepository 's'
+  abort: uncommitted changes in subrepository "s"
   (use --subrepos for recursive commit)
   [255]
   $ hg id
@@ -305,7 +305,7 @@ 
    subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198)
   starting 4 threads for background file closing (?)
   (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
-  merging subrepo t
+  merging subrepository "t"
     searching for copies back to rev 2
   resolving manifests
    branchmerge: True, force: False, partial: False
@@ -516,7 +516,7 @@ 
   no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
   pushing subrepo s to $TESTTMP/t/s
   searching for changes
-  abort: push creates new remote head 12a213df6fa9! (in subrepo s)
+  abort: push creates new remote head 12a213df6fa9! (in subrepository "s")
   (merge or see 'hg help push' for details about pushing new heads)
   [255]
   $ hg push -f
@@ -747,7 +747,7 @@ 
 
   $ echo 'bogus=[boguspath' >> .hgsub
   $ hg ci -m 'bogus subrepo path'
-  abort: missing ] in subrepo source
+  abort: missing ] in subrepository source
   [255]
 
 Issue1986: merge aborts when trying to merge a subrepo that
@@ -955,7 +955,7 @@ 
   created new head
   $ hg -R repo2 ci -m3
   $ hg -q -R repo2 push
-  abort: push creates new remote head cc505f09a8b2! (in subrepo s)
+  abort: push creates new remote head cc505f09a8b2! (in subrepository "s")
   (merge or see 'hg help push' for details about pushing new heads)
   [255]
   $ hg -R repo update
@@ -983,7 +983,7 @@ 
   > EOF
   $ hg -R repo update
   b: untracked file differs
-  abort: untracked files in working directory differ from files in requested revision (in subrepo s)
+  abort: untracked files in working directory differ from files in requested revision (in subrepository "s")
   [255]
   $ cat >> repo/.hg/hgrc <<EOF
   > [extensions]
@@ -1055,7 +1055,7 @@ 
   added 2 changesets with 3 changes to 2 files
   (run 'hg update' to get a working copy)
   $ hg -R issue1852b update
-  abort: default path for subrepository not found (in subrepo sub/repo) (glob)
+  abort: default path for subrepository not found (in subrepository "sub/repo") (glob)
   [255]
 
 Ensure a full traceback, not just the SubrepoAbort part
diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -173,7 +173,7 @@ 
   M foo
 
   $ revtest '-c dirtysub linear'   dirtysub 1 2 -c
-  abort: uncommitted changes in subrepository 'sub'
+  abort: uncommitted changes in subrepository "sub"
   parent=1
   M sub/suba