Commits

Martin Geisler committed 61992df

rebased to e615765fdcc7

  • Participants
  • Parent commits 8151267

Comments (0)

Files changed (1)

File implementation

 # HG changeset patch
 # User Henrik Stuart <hg@hstuart.dk>
 # Date 1297282594 -3600
-# Node ID 344d24772e56526f8fa256a0103065f86a73bdd7
-# Parent  9c4e04fe267eedddbfe964227948b5bc501d3027
+# Node ID 784a70c78ef3f3754a9bb076fa6537af5a1b8a70
+# Parent  e615765fdcc79eb87e237edd5fcb40c1839b1ea7
 add support for marking changesets as dead
 
 Marking a changeset as dead is, if it is a head, a way to delete a
      e = cmdutil.commiteditor
      if opts.get('force_editor'):
          e = cmdutil.commitforceeditor
-@@ -1951,7 +1960,7 @@
+@@ -1963,7 +1972,7 @@
          start = cmdutil.revsingle(repo, opts['rev'], None).node()
  
      if opts.get('topo'):
      else:
          heads = []
          for b, ls in repo.branchmap().iteritems():
-@@ -1971,6 +1980,9 @@
+@@ -1983,6 +1992,9 @@
      if not opts.get('closed'):
          heads = [h for h in heads if not h.extra().get('close')]
  
      if opts.get('active') and branchrevs:
          dagheads = repo.heads(start)
          heads = [h for h in heads if h.node() in dagheads]
-@@ -2686,6 +2698,13 @@
+@@ -2698,6 +2710,13 @@
              return
          if opts.get('only_merges') and len(parents) != 2:
              return
          if opts.get('branch') and ctx.branch() not in opts['branch']:
              return
          if df and not df(ctx.date()[0]):
-@@ -2793,6 +2812,7 @@
+@@ -2805,6 +2824,7 @@
      if not node:
          branch = repo[None].branch()
          bheads = repo.branchheads(branch)
          if len(bheads) > 2:
              raise util.Abort(_(
                  'branch \'%s\' has %d heads - '
-@@ -2995,7 +3015,8 @@
+@@ -3007,7 +3027,8 @@
                      "so a rev cannot be specified.")
              raise util.Abort(err)
  
      bookmarks.updatefromremote(ui, repo, other)
      if checkout:
          checkout = str(repo.changelog.rev(other.lookup(checkout)))
-@@ -3075,7 +3096,8 @@
+@@ -3087,7 +3108,8 @@
      finally:
          del repo._subtoppath
      result = repo.push(other, opts.get('force'), revs=revs,
  
      result = (result == 0)
  
-@@ -4352,7 +4374,9 @@
+@@ -4364,7 +4386,9 @@
           [('a', 'active', False,
             _('show only branches that have unmerged heads')),
            ('c', 'closed', False,
           _('[-ac]')),
      "bundle":
          (bundle,
-@@ -4394,6 +4418,8 @@
+@@ -4406,6 +4430,8 @@
            ('', 'pull', None, _('use pull protocol to copy metadata')),
            ('', 'uncompressed', None,
             _('use uncompressed transfer (fast over LAN)')),
           ] + remoteopts,
           _('[OPTION]... SOURCE [DEST]')),
      "^commit|ci":
-@@ -4402,6 +4428,8 @@
+@@ -4414,6 +4440,8 @@
             _('mark new/missing files as added/removed before committing')),
            ('', 'close-branch', None,
             _('mark a branch as closed, hiding it from the branch list')),
           ] + walkopts + commitopts + commitopts2,
           _('[OPTION]... [FILE]...')),
      "copy|cp":
-@@ -4525,6 +4553,8 @@
+@@ -4538,6 +4566,8 @@
             _('show active branchheads only (DEPRECATED)')),
            ('c', 'closed', False,
             _('show normal and closed branch heads')),
           ] + templateopts,
           _('[-ac] [-r STARTREV] [REV]...')),
      "help": (help_, [], _('[TOPIC]')),
-@@ -4568,6 +4598,7 @@
+@@ -4581,6 +4611,7 @@
            ('B', 'bookmarks', False, _("compare bookmarks")),
            ('b', 'branch', [],
             _('a specific branch you would like to pull'), _('BRANCH')),
           ] + logopts + remoteopts + subrepoopts,
           _('[-p] [-n] [-M] [-f] [-r REV]...'
             ' [--bundle FILENAME] [SOURCE]')),
-@@ -4600,6 +4631,7 @@
+@@ -4613,6 +4644,7 @@
            ('r', 'rev', [],
             _('show the specified revision or range'), _('REV')),
            ('', 'removed', None, _('include revisions where files were removed')),
            ('m', 'only-merges', None, _('show only merges')),
            ('u', 'user', [],
             _('revisions committed by user'), _('USER')),
-@@ -4637,6 +4669,7 @@
+@@ -4650,6 +4682,7 @@
            ('B', 'bookmarks', False, _("compare bookmarks")),
            ('b', 'branch', [],
             _('a specific branch you would like to push'), _('BRANCH')),
           ] + logopts + remoteopts + subrepoopts,
           _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
      "parents":
-@@ -4657,6 +4690,7 @@
+@@ -4670,6 +4703,7 @@
            ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')),
            ('b', 'branch', [],
             _('a specific branch you would like to pull'), _('BRANCH')),
           ] + remoteopts,
           _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
      "^push":
-@@ -4669,6 +4703,7 @@
+@@ -4682,6 +4716,7 @@
            ('b', 'branch', [],
             _('a specific branch you would like to push'), _('BRANCH')),
            ('', 'new-branch', False, _('allow pushing a new branch')),
 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
 --- a/mercurial/localrepo.py
 +++ b/mercurial/localrepo.py
-@@ -20,7 +20,8 @@
- propertycache = util.propertycache
+@@ -21,7 +21,7 @@
  
  class localrepository(repo.repository):
--    capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey'))
-+    capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey',
-+        'dead'))
+     capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey',
+-                        'known'))
++                        'known', 'dead'))
      supportedformats = set(('revlogv1', 'parentdelta'))
      supported = supportedformats | set(('store', 'fncache', 'shared',
                                          'dotencode'))
-@@ -969,7 +970,8 @@
+@@ -974,7 +974,8 @@
  
              if (not force and not extra.get("close") and not merge
                  and not (changes[0] or changes[1] or changes[2])
                  return None
  
              ms = mergemod.mergestate(self)
-@@ -1255,10 +1257,31 @@
+@@ -1260,10 +1261,31 @@
              l.sort()
          return r
  
  
      def branchheads(self, branch=None, start=None, closed=False):
          '''return a (possibly filtered) list of heads for the given branch
-@@ -1317,11 +1340,11 @@
+@@ -1322,11 +1344,11 @@
  
          return r
  
              common, fetch, rheads = tmp
              if not fetch:
                  self.ui.status(_("no changes found\n"))
-@@ -1334,7 +1357,7 @@
+@@ -1339,7 +1361,7 @@
                      heads = rheads
  
                  if heads is None:
                  elif not remote.capable('changegroupsubset'):
                      raise util.Abort(_("partial pull cannot be done because "
                                             "other repository doesn't support "
-@@ -1348,14 +1371,14 @@
+@@ -1353,14 +1375,14 @@
  
          return result
  
          '''Push outgoing changesets (limited by revs) from the current
          repository to remote. Return an integer:
            - 0 means HTTP error *or* nothing to push
-@@ -1371,14 +1394,14 @@
+@@ -1376,14 +1398,14 @@
          # unbundle assumes local user cannot lock remote repo (new ssh
          # servers, http servers).
  
              ret = remote_heads
              if cg is not None:
                  if unbundle:
-@@ -1390,11 +1413,11 @@
+@@ -1395,11 +1417,11 @@
                          remote_heads = ['force']
                      # ssh: return remote's addchangegroup()
                      # http: return remote's addchangegroup() or 0 for error
          finally:
              if lock is not None:
                  lock.release()
-@@ -1450,7 +1473,7 @@
+@@ -1455,7 +1477,7 @@
  
          # can we go through the fast path ?
          heads.sort()
              return self._changegroup(csets, source)
  
          # slow path
-@@ -1566,9 +1589,9 @@
+@@ -1571,9 +1593,9 @@
  
          return changegroup.unbundle10(util.chunkbuffer(gengroup()), 'UN')
  
  
      def _changegroup(self, nodes, source):
          """Compute the changegroup of all nodes that we have that a recipient
-@@ -1647,7 +1670,8 @@
+@@ -1652,7 +1674,8 @@
  
          return changegroup.unbundle10(util.chunkbuffer(gengroup()), 'UN')
  
          """Add the changegroup returned by source.read() to this repo.
          srctype is a string like 'push', 'pull', or 'unbundle'.  url is
          the URL of the repo where this changegroup is coming from.
-@@ -1871,7 +1895,7 @@
+@@ -1876,7 +1899,7 @@
          finally:
              lock.release()
  
          '''clone remote repository.
  
          keyword arguments:
-@@ -1886,7 +1910,7 @@
+@@ -1891,7 +1914,7 @@
          # and format flags on "stream" capability, and use
          # uncompressed only if compatible.
  
              # 'stream' means remote revlog format is revlogv1 only
              if remote.capable('stream'):
                  return self.stream_in(remote, set(('revlogv1',)))
-@@ -1897,7 +1921,7 @@
+@@ -1902,7 +1925,7 @@
                  # if we support it, stream in and adjust our requirements
                  if not streamreqs - self.supportedformats:
                      return self.stream_in(remote, streamreqs)
 diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
 --- a/mercurial/wireproto.py
 +++ b/mercurial/wireproto.py
-@@ -31,13 +31,35 @@
+@@ -33,8 +33,8 @@
              return bin(data)
          self._abort(error.RepoError(data))
  
          try:
              return decodelist(d[:-1])
          except:
+@@ -48,6 +48,28 @@
+         except:
              self._abort(error.ResponseError(_("unexpected response:"), d))
  
 +    def makesdead(self, heads):
      def branchmap(self):
          d = self._call("branchmap")
          try:
-@@ -100,7 +122,14 @@
+@@ -110,7 +132,14 @@
      def stream_out(self):
          return self._callstream('stream_out')
  
          n = encodelist(nodes)
          f = self._callstream("changegroup", roots=n)
          return changegroupmod.unbundle10(self._decompress(f), 'UN')
-@@ -113,7 +142,7 @@
+@@ -123,7 +152,7 @@
                               bases=bases, heads=heads)
          return changegroupmod.unbundle10(self._decompress(f), 'UN')
  
          '''Send cg (a readable file-like object representing the
          changegroup to push, typically a chunkbuffer object) to the
          remote server as a bundle. Return an integer indicating the
-@@ -185,7 +214,7 @@
+@@ -206,7 +235,7 @@
      return "".join(r)
  
  def capabilities(repo, proto):
--    caps = 'lookup changegroupsubset branchmap pushkey'.split()
-+    caps = 'lookup changegroupsubset branchmap pushkey dead'.split()
+-    caps = 'lookup changegroupsubset branchmap pushkey known'.split()
++    caps = 'lookup changegroupsubset branchmap pushkey known dead'.split()
      if _allowstream(repo.ui):
          requiredformats = repo.requirements & repo.supportedformats
          # if our local revlogs are just revlogv1, add 'stream' cap
-@@ -202,6 +231,11 @@
+@@ -223,6 +252,11 @@
      cg = repo.changegroup(nodes, 'serve')
      return streamres(proto.groupchunks(cg))
  
  def changegroupsubset(repo, proto, bases, heads):
      bases = decodelist(bases)
      heads = decodelist(heads)
-@@ -211,10 +245,18 @@
- def debugwireargs(repo, proto, one, two):
-     return repo.debugwireargs(one, two)
+@@ -234,10 +268,18 @@
+     opts = options('debugwireargs', ['three', 'four'], others)
+     return repo.debugwireargs(one, two, **opts)
  
 +def makesdead(repo, proto, heads):
 +    heads = decodelist(heads)
  def hello(repo, proto):
      '''the hello command returns a set of lines describing various
      interesting things about the server, in an RFC822-like format.
-@@ -354,13 +396,16 @@
+@@ -380,9 +422,11 @@
      'branches': (branches, 'nodes'),
      'capabilities': (capabilities, ''),
      'changegroup': (changegroup, 'roots'),
 +    'deadchangegroup': (deadchangegroup, 'roots dead'),
      'changegroupsubset': (changegroupsubset, 'bases heads'),
-     'debugwireargs': (debugwireargs, 'one two'),
+     'debugwireargs': (debugwireargs, 'one two *'),
      'heads': (heads, ''),
 +    'deadheads': (deadheads, 'dead'),
      'hello': (hello, ''),
+     'known': (known, 'nodes'),
      'listkeys': (listkeys, 'namespace'),
-     'lookup': (lookup, 'key'),
+@@ -390,4 +434,5 @@
      'pushkey': (pushkey, 'namespace key old new'),
      'stream_out': (stream, ''),
      'unbundle': (unbundle, 'heads'),
 diff --git a/tests/test-debugcomplete.t b/tests/test-debugcomplete.t
 --- a/tests/test-debugcomplete.t
 +++ b/tests/test-debugcomplete.t
-@@ -182,16 +182,16 @@
+@@ -183,16 +183,16 @@
    $ hg debugcommands
    add: include, exclude, subrepos, dry-run
    annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, include, exclude
    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
-@@ -203,7 +203,7 @@
+@@ -204,7 +204,7 @@
    bisect: reset, good, bad, skip, extend, command, noupdate
    bookmarks: force, rev, delete, rename
    branch: force, clean
    bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
    cat: output, rev, decode, include, exclude
    copy: after, force, include, exclude, dry-run
-@@ -230,14 +230,14 @@
+@@ -232,14 +232,14 @@
    debugwalk: include, exclude
    debugwireargs: three, four, ssh, remotecmd, insecure
    grep: print0, all, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude
    $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=capabilities'; echo
    200 Script output follows
    
--  lookup changegroupsubset branchmap pushkey unbundle=HG10GZ,HG10BZ,HG10UN
-+  lookup changegroupsubset branchmap pushkey dead unbundle=HG10GZ,HG10BZ,HG10UN
+-  lookup changegroupsubset branchmap pushkey known unbundle=HG10GZ,HG10BZ,HG10UN
++  lookup changegroupsubset branchmap pushkey known dead unbundle=HG10GZ,HG10BZ,HG10UN
  
  heads