Commits

Martin Geisler committed 059d8fc

Add a nonabandoned wireprotocol capability

  • Participants
  • Parent commits 70c75f8

Comments (0)

Files changed (6)

File abandon-command

 # HG changeset patch
 # User Martin Geisler <mg@lazybytes.net>
 # Date 1306919141 -7200
-# Node ID 48ec4adb7c86ab9449878134ac0f8e1b30aae8bf
-# Parent 680cf235c75d0174997f91d5d212469d1d5799e8
+# Node ID b12d304312694d1b6d3c4026c87d4dd15525e188
+# Parent  f8db33afb6c0f61f54b6aa06643e48dd76c54163
 commands: add abandon command
 
 Abandoned changesets are hidden from 'hg log' by default.

File abandoned-revset

 # HG changeset patch
 # User Martin Geisler <mg@lazybytes.net>
 # Date 1306919165 -7200
-# Node ID c78f79e441df7be0db424bd3217c1ae5692ebd4b
-# Parent  48ec4adb7c86ab9449878134ac0f8e1b30aae8bf
+# Node ID 59db7173bc235b8be2eb9a51c91e4ac9ebfa6f0d
+# Parent  b12d304312694d1b6d3c4026c87d4dd15525e188
 revset: add abandoned keyword
 
 diff --git a/mercurial/revset.py b/mercurial/revset.py
 diff --git a/tests/test-abandoned.t b/tests/test-abandoned.t
 --- a/tests/test-abandoned.t
 +++ b/tests/test-abandoned.t
-@@ -44,3 +44,9 @@
+@@ -43,3 +43,9 @@
    2 339976ff5010 abandoned
    1 0b00c28422ee x
    0 54dbcd775ef0 init
 # HG changeset patch
-# Parent a67e866f46f9919a963afb4e4f1bb4a2c56a3c42
+# User Martin Geisler <mg@aragost.com>
+# Date 1307118242 -7200
+# Node ID f8db33afb6c0f61f54b6aa06643e48dd76c54163
+# Parent  28682c7e7479ab4b247fa4f7c9bdf796c12fd7b5
 changelog: add infrastructure for hiding changesets
 
 diff --git a/mercurial/changelog.py b/mercurial/changelog.py
 # User Martin Geisler <mg@lazybytes.net>
 # Date 1306919172 -7200
 # Node ID 42c450076c85e537049306f87b4d2bdffbd2d926
-# Parent e885e5b30465337a6dd9e663a03d56f6e378c1d6
+# Parent 59db7173bc235b8be2eb9a51c91e4ac9ebfa6f0d
 commands: add --abandoned flag to push, pull, outgoing, and incoming
 
 The flag makes the commands include abandoned changesets, the default
 +
 +    commonheads = [c for c in common if c in repo.heads()]
 +
-+    if not abandoned:
++    if not abandoned and remote.capable('nonabandoned'):
 +        rheads = remote.nonabandoned(rheads, commonheads)
 +        if util.all(rh in repo for rh in rheads):
 +             anyinc = False
 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
 --- a/mercurial/localrepo.py
 +++ b/mercurial/localrepo.py
+@@ -20,7 +20,7 @@
+ 
+ class localrepository(repo.repository):
+     capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey',
+-                        'known', 'getbundle'))
++                        'known', 'getbundle', 'nonabandoned'))
+     supportedformats = set(('revlogv1', 'generaldelta'))
+     supported = supportedformats | set(('store', 'fncache', 'shared',
+                                         'dotencode'))
 @@ -613,6 +613,96 @@
          self.updateabandonedcache()
          return self._abandonedcache.get(self[changeid].node())
          common = [self.rev(n) for n in common]
          heads = [self.rev(n) for n in heads]
  
+diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
+--- a/mercurial/statichttprepo.py
++++ b/mercurial/statichttprepo.py
+@@ -124,7 +124,7 @@
+         self._branchcachetip = None
+         self.encodepats = None
+         self.decodepats = None
+-        self.capabilities.difference_update(["pushkey"])
++        self.capabilities.difference_update(["pushkey", "nonabandoned"])
+ 
+     def url(self):
+         return self._url
 diff --git a/tests/test-abandon-abandoned.t b/tests/test-abandon-abandoned.t
 new file mode 100644
 --- /dev/null
 +  1 0b00c28422ee x
 +  0 54dbcd775ef0 init
 +  $ hg rollback -q
+diff --git a/tests/test-debugcomplete.t b/tests/test-debugcomplete.t
+--- a/tests/test-debugcomplete.t
++++ b/tests/test-debugcomplete.t
+@@ -198,8 +198,8 @@
+   init: ssh, remotecmd, insecure
+   log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, hidden, patch, git, limit, no-merges, stat, style, template, include, exclude
+   merge: force, tool, rev, preview
+-  pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
+-  push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure
++  pull: update, force, abandoned, rev, bookmark, branch, ssh, remotecmd, insecure
++  push: force, abandoned, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure
+   remove: after, force, include, exclude
+   serve: accesslog, daemon, daemon-pipefds, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, templates, style, ipv6, certificate
+   status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos
+@@ -249,10 +249,10 @@
+   help: extension, command
+   identify: rev, num, id, branch, tags, bookmarks
+   import: strip, base, force, no-commit, exact, import-branch, message, logfile, date, user, similarity
+-  incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
++  incoming: force, abandoned, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
+   locate: rev, print0, fullpath, include, exclude
+   manifest: rev, all
+-  outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
++  outgoing: force, abandoned, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
+   parents: rev, style, template
+   paths: 
+   recover: 
+copy-of-81e6d42b3228 #+old
+copy-of-08fde203a600 #+old
+old-abandon #+old
 hidden
 abandon-command
 abandoned-revset
 postincoming
 clone
 heads
-copy-of-81e6d42b3228 #+old
-copy-of-08fde203a600 #+old
-old-abandon #+old
 # Placed by Bitbucket
 # User Martin Geisler <mg@lazybytes.net>
 # Date 1306923811 -7200
 # Node ID dc6390ced27044d8711da7995a93f6babdacfba3
-# Parent 55f74ab4ce0956aa0d1e3583f697d508b260422f
+# Parent 73a6f24415b0f3a0f777514a436ef5b52909ca54
 wireproto: add nonabandoned wireproto command
 
 Used with httprepo and sshrepo to let the server prune the list of
          return ret
  
 +    def nonabandoned(self, candidates, clientheads):
-+        self.requirecap('getbundle', _('look up non-abandoned heads'))
++        self.requirecap('nonabandoned', _('look up non-abandoned heads'))
 +        opts = {}
 +        opts['candidates'] = encodelist(candidates)
 +        opts['clientheads'] = encodelist(clientheads)
      def debugwireargs(self, one, two, three=None, four=None, five=None):
          # don't pass optional arguments left at their default value
          opts = {}
+@@ -223,7 +234,7 @@
+ 
+ def capabilities(repo, proto):
+     caps = ('lookup changegroupsubset branchmap pushkey known getbundle '
+-            'unbundlehash').split()
++            'unbundlehash nonabandoned').split()
+     if _allowstream(repo.ui):
+         requiredformats = repo.requirements & repo.supportedformats
+         # if our local revlogs are just revlogv1, add 'stream' cap
 @@ -291,6 +302,11 @@
  def known(repo, proto, nodes, others):
      return ''.join(b and "1" or "0" for b in repo.known(decodelist(nodes)))
  testing incoming with a shared abandoned changeset
  
    $ cd ../base-x
-diff --git a/tests/test-debugcomplete.t b/tests/test-debugcomplete.t
---- a/tests/test-debugcomplete.t
-+++ b/tests/test-debugcomplete.t
-@@ -198,8 +198,8 @@
-   init: ssh, remotecmd, insecure
-   log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, hidden, patch, git, limit, no-merges, stat, style, template, include, exclude
-   merge: force, tool, rev, preview
--  pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
--  push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure
-+  pull: update, force, abandoned, rev, bookmark, branch, ssh, remotecmd, insecure
-+  push: force, abandoned, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure
-   remove: after, force, include, exclude
-   serve: accesslog, daemon, daemon-pipefds, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, templates, style, ipv6, certificate
-   status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos
-@@ -249,10 +249,10 @@
-   help: extension, command
-   identify: rev, num, id, branch, tags, bookmarks
-   import: strip, base, force, no-commit, exact, import-branch, message, logfile, date, user, similarity
--  incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
-+  incoming: force, abandoned, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
-   locate: rev, print0, fullpath, include, exclude
-   manifest: rev, all
--  outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
-+  outgoing: force, abandoned, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
-   parents: rev, style, template
-   paths: 
-   recover: 
+diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
+--- a/tests/test-hgweb-commands.t
++++ b/tests/test-hgweb-commands.t
+@@ -952,7 +952,7 @@
+   $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=capabilities'; echo
+   200 Script output follows
+   
+-  lookup changegroupsubset branchmap pushkey known getbundle unbundlehash unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
++  lookup changegroupsubset branchmap pushkey known getbundle unbundlehash nonabandoned unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
+ 
+ heads
+ 
 diff --git a/tests/test-http-proxy.t b/tests/test-http-proxy.t
 --- a/tests/test-http-proxy.t
 +++ b/tests/test-http-proxy.t