changeset 17835:08d11b82d9fc

largefiles: distinguish "no remote repo" from "no files to upload" (issue3651) Before this patch, when no files to upload, "hg outgoing --large" and "hg summary --large" show "no remote repo", even though valid remote repository is specified. It is because that "getoutgoinglfiles()" returns None, not only if no valid remote repository is specified, but also if no files to upload. This patch makes "getoutgoinglfiles()" return empty list when no files to upload, and makes largefiles show "no files to upload" message at that time. This patch doesn't test "if toupload is None" route in "overrideoutgoing()", because this route is not executed unless remote repository becomes inaccessible just before largefiles specific processing: successful execution of "orig()" means that at least one of "default", "default-push" or dest is valid one, and that "getoutgoinglfiles()" never returns None in such cases. At "hg summary --large" invocation, this patch shows message below: largefiles: (no files to upload) This follows the message shown by "hg summary" with MQ: mq: (empty queue)
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 08 Oct 2012 23:49:36 +0900
parents 743d04dd48ec
children 98347af64593
files hgext/largefiles/overrides.py tests/test-largefiles.t
diffstat 2 files changed, 89 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Fri Oct 19 00:50:12 2012 +0200
+++ b/hgext/largefiles/overrides.py	Mon Oct 08 23:49:36 2012 +0900
@@ -968,7 +968,7 @@
         return None
     o = lfutil.findoutgoing(repo, remote, False)
     if not o:
-        return None
+        return o
     o = repo.changelog.nodesbetween(o, revs)[0]
     if opts.get('newest_first'):
         o.reverse()
@@ -1002,6 +1002,8 @@
         toupload = getoutgoinglfiles(ui, repo, dest, **opts)
         if toupload is None:
             ui.status(_('largefiles: No remote repo\n'))
+        elif not toupload:
+            ui.status(_('largefiles: no files to upload\n'))
         else:
             ui.status(_('largefiles to upload:\n'))
             for file in toupload:
@@ -1021,6 +1023,8 @@
         toupload = getoutgoinglfiles(ui, repo, None, **opts)
         if toupload is None:
             ui.status(_('largefiles: No remote repo\n'))
+        elif not toupload:
+            ui.status(_('largefiles: (no files to upload)\n'))
         else:
             ui.status(_('largefiles: %d to upload\n') % len(toupload))
 
--- a/tests/test-largefiles.t	Fri Oct 19 00:50:12 2012 +0200
+++ b/tests/test-largefiles.t	Mon Oct 08 23:49:36 2012 +0900
@@ -1627,3 +1627,87 @@
   .hglf/large2.dat
 
   $ cd ..
+
+issue3651: summary/outgoing with largefiles shows "no remote repo"
+unexpectedly
+
+  $ mkdir issue3651
+  $ cd issue3651
+
+  $ hg init src
+  $ echo a > src/a
+  $ hg -R src add --large src/a
+  $ hg -R src commit -m '#0'
+  Invoking status precommit hook
+  A a
+
+check messages when no remote repository is specified:
+"no remote repo" route for "hg outgoing --large" is not tested here,
+because it can't be reproduced easily.
+
+  $ hg init clone1
+  $ hg -R clone1 -q pull src
+  $ hg -R clone1 -q update
+  $ hg -R clone1 paths | grep default
+  [1]
+
+  $ hg -R clone1 summary --large
+  parent: 0:fc0bd45326d3 tip
+   #0
+  branch: default
+  commit: (clean)
+  update: (current)
+  largefiles: No remote repo
+
+check messages when there is no files to upload:
+
+  $ hg -q clone src clone2
+  $ hg -R clone2 paths | grep default
+  default = $TESTTMP/issue3651/src
+
+  $ hg -R clone2 summary --large
+  parent: 0:fc0bd45326d3 tip
+   #0
+  branch: default
+  commit: (clean)
+  update: (current)
+  searching for changes
+  largefiles: (no files to upload)
+  $ hg -R clone2 outgoing --large
+  comparing with $TESTTMP/issue3651/src
+  searching for changes
+  no changes found
+  searching for changes
+  largefiles: no files to upload
+  [1]
+
+check messages when there are files to upload:
+
+  $ echo b > clone2/b
+  $ hg -R clone2 add --large clone2/b
+  $ hg -R clone2 commit -m '#1'
+  Invoking status precommit hook
+  A b
+  $ hg -R clone2 summary --large
+  parent: 1:1acbe71ce432 tip
+   #1
+  branch: default
+  commit: (clean)
+  update: (current)
+  searching for changes
+  largefiles: 1 to upload
+  $ hg -R clone2 outgoing --large
+  comparing with $TESTTMP/issue3651/src
+  searching for changes
+  changeset:   1:1acbe71ce432
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     #1
+  
+  searching for changes
+  largefiles to upload:
+  b
+  
+
+  $ cd ..