scmutil: unify some 'no changes found' messages stable
authorMatt Mackall <mpm@selenic.com>
Wed, 25 Jan 2012 17:14:08 -0600
branchstable
changeset 15993 0b05e0bfdc1c
parent 15992 963c8a553524
child 15994 3c2ce5c2cee0
scmutil: unify some 'no changes found' messages This keeps the wording more consistent for secret csets
mercurial/commands.py
mercurial/hg.py
mercurial/localrepo.py
mercurial/scmutil.py
tests/test-bundle.t
tests/test-incoming-outgoing.t
tests/test-mq-safety.t
--- a/mercurial/commands.py	Wed Jan 25 19:41:34 2012 +0100
+++ b/mercurial/commands.py	Wed Jan 25 17:14:08 2012 -0600
@@ -983,6 +983,7 @@
         common = [repo.lookup(rev) for rev in base]
         heads = revs and map(repo.lookup, revs) or revs
         cg = repo.getbundle('bundle', heads=heads, common=common)
+        outgoing = None
     else:
         dest = ui.expandpath(dest or 'default-push', dest or 'default')
         dest, branches = hg.parseurl(dest, opts.get('branch'))
@@ -994,11 +995,7 @@
                                                 force=opts.get('force'))
         cg = repo.getlocalbundle('bundle', outgoing)
     if not cg:
-        if 'outgoing' in locals() and outgoing.excluded:
-            repo.ui.status(_("no changes found but %i secret changesets\n")
-                           % len(outgoing.excluded))
-        else:
-            ui.status(_("no changes found\n"))
+        scmutil.nochangesfound(ui, outgoing and outgoing.excluded)
         return 1
 
     bundletype = opts.get('type', 'bzip2').lower()
--- a/mercurial/hg.py	Wed Jan 25 19:41:34 2012 +0100
+++ b/mercurial/hg.py	Wed Jan 25 17:14:08 2012 -0600
@@ -10,7 +10,7 @@
 from lock import release
 from node import hex, nullid
 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo, bookmarks
-import lock, util, extensions, error, node
+import lock, util, extensions, error, node, scmutil
 import cmdutil, discovery
 import merge as mergemod
 import verify as verifymod
@@ -511,11 +511,7 @@
                                             force=opts.get('force'))
     o = outgoing.missing
     if not o:
-        if outgoing.excluded:
-            repo.ui.status(_("no outgoing changes but %i secret changesets\n")
-                           % len(outgoing.excluded))
-        else:
-            ui.status(_("no changes found\n"))
+        scmutil.nochangesfound(repo.ui, outgoing.excluded)
         return None
     return o
 
--- a/mercurial/localrepo.py	Wed Jan 25 19:41:34 2012 +0100
+++ b/mercurial/localrepo.py	Wed Jan 25 17:14:08 2012 -0600
@@ -1629,11 +1629,7 @@
 
                 if not outgoing.missing:
                     # nothing to push
-                    if outgoing.excluded:
-                        msg = "no changes to push but %i secret changesets\n"
-                        self.ui.status(_(msg) % len(outgoing.excluded))
-                    else:
-                        self.ui.status(_("no changes found\n"))
+                    scmutil.nochangesfound(self.ui, outgoing.excluded)
                     ret = 1
                 else:
                     # something to push
--- a/mercurial/scmutil.py	Wed Jan 25 19:41:34 2012 +0100
+++ b/mercurial/scmutil.py	Wed Jan 25 17:14:08 2012 -0600
@@ -10,6 +10,14 @@
 import match as matchmod
 import os, errno, re, stat, sys, glob
 
+def nochangesfound(ui, secretlist=None):
+    '''report no changes for push/pull'''
+    if secretlist:
+        ui.status(_("no changes found (ignored %d secret changesets)\n")
+                  % len(secretlist))
+    else:
+        ui.status(_("no changes found\n"))
+
 def checkfilename(f):
     '''Check that the filename f is an acceptable filename for a tracked file'''
     if '\r' in f or '\n' in f:
--- a/tests/test-bundle.t	Wed Jan 25 19:41:34 2012 +0100
+++ b/tests/test-bundle.t	Wed Jan 25 17:14:08 2012 -0600
@@ -44,7 +44,7 @@
   $ hg -R test phase --force --secret 0
   $ hg -R test bundle phase.hg empty
   searching for changes
-  no changes found but 9 secret changesets
+  no changes found (ignored 9 secret changesets)
   [1]
   $ hg -R test phase --draft -r 'head()'
 
--- a/tests/test-incoming-outgoing.t	Wed Jan 25 19:41:34 2012 +0100
+++ b/tests/test-incoming-outgoing.t	Wed Jan 25 17:14:08 2012 -0600
@@ -405,7 +405,7 @@
   $ hg -R test-dev outgoing test
   comparing with test
   searching for changes
-  no outgoing changes but 5 secret changesets
+  no changes found (ignored 5 secret changesets)
   [1]
   $ hg -R test-dev phase --draft -r 'head()'
 
--- a/tests/test-mq-safety.t	Wed Jan 25 19:41:34 2012 +0100
+++ b/tests/test-mq-safety.t	Wed Jan 25 17:14:08 2012 -0600
@@ -149,7 +149,7 @@
   $ hg push -r . ../forcepush2
   pushing to ../forcepush2
   searching for changes
-  no changes to push but 1 secret changesets
+  no changes found (ignored 1 secret changesets)
 
 some draft
 
@@ -183,7 +183,7 @@
   $ hg push --force -r default ../forcepush2
   pushing to ../forcepush2
   searching for changes
-  no changes to push but 1 secret changesets
+  no changes found (ignored 1 secret changesets)
   $ hg phase --draft 'mq()'
   $ hg push --force -r default ../forcepush2
   pushing to ../forcepush2