diff hgext/largefiles/overrides.py @ 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 221c9c3146eb
children 1e4eb1faba6e
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))