Exemple #1
0
 def changegroupsubset(self, bases, heads, kind):
     self.requirecap('changegroupsubset', _('look up remote changes'))
     bases = encodelist(bases)
     heads = encodelist(heads)
     f = self._callstream("changegroupsubset",
                          bases=bases, heads=heads)
     return changegroupmod.unbundle10(self._decompress(f), 'UN')
Exemple #2
0
def readbundle(ui, fh, fname, vfs=None):
    header = changegroup.readexactly(fh, 4)

    alg = None
    if not fname:
        fname = "stream"
        if not header.startswith('HG') and header.startswith('\0'):
            fh = changegroup.headerlessfixup(fh, header)
            header = "HG10"
            alg = 'UN'
    elif vfs:
        fname = vfs.join(fname)

    magic, version = header[0:2], header[2:4]

    if magic != 'HG':
        raise util.Abort(_('%s: not a Mercurial bundle') % fname)
    if version == '10':
        if alg is None:
            alg = changegroup.readexactly(fh, 2)
        return changegroup.unbundle10(fh, alg)
    elif version == '2X':
        return bundle2.unbundle20(ui, fh, header=magic + version)
    else:
        raise util.Abort(_('%s: unknown bundle version %s') % (fname, version))
 def changegroupsubset(self, bases, heads, kind):
     self.requirecap('changegroupsubset', _('look up remote changes'))
     bases = encodelist(bases)
     heads = encodelist(heads)
     f = self._callstream("changegroupsubset",
                          bases=bases, heads=heads)
     return changegroupmod.unbundle10(self._decompress(f), 'UN')
 def getbundle(self, source, heads=None, common=None):
     self.requirecap('getbundle', _('look up remote changes'))
     opts = {}
     if heads is not None:
         opts['heads'] = encodelist(heads)
     if common is not None:
         opts['common'] = encodelist(common)
     f = self._callstream("getbundle", **opts)
     return changegroupmod.unbundle10(self._decompress(f), 'UN')
 def getbundle(self, source, heads=None, common=None):
     self.requirecap('getbundle', _('look up remote changes'))
     opts = {}
     if heads is not None:
         opts['heads'] = encodelist(heads)
     if common is not None:
         opts['common'] = encodelist(common)
     f = self._callstream("getbundle", **opts)
     return changegroupmod.unbundle10(self._decompress(f), 'UN')
    def do_addchangegroup(self):
        '''DEPRECATED'''

        if not self.lock:
            self.sendresponse("not locked")
            return

        self.sendresponse("")
        cg = changegroup.unbundle10(self.fin, "UN")
        r = self.repo.addchangegroup(cg, 'serve', self._client())
        self.lock.release()
        return str(r)
Exemple #7
0
    def do_addchangegroup(self):
        '''DEPRECATED'''

        if not self.lock:
            self.sendresponse("not locked")
            return

        self.sendresponse("")
        cg = changegroup.unbundle10(self.fin, "UN")
        r = self.repo.addchangegroup(cg, 'serve', self._client(),
                                     lock=self.lock)
        return str(r)
 def getbundle(self, source, heads=None, common=None, bundlecaps=None,
               **kwargs):
     self.requirecap('getbundle', _('look up remote changes'))
     opts = {}
     if heads is not None:
         opts['heads'] = encodelist(heads)
     if common is not None:
         opts['common'] = encodelist(common)
     if bundlecaps is not None:
         opts['bundlecaps'] = ','.join(bundlecaps)
     opts.update(kwargs)
     f = self._callcompressable("getbundle", **opts)
     if bundlecaps is not None and 'HG2X' in bundlecaps:
         return bundle2.unbundle20(self.ui, f)
     else:
         return changegroupmod.unbundle10(f, 'UN')
Exemple #9
0
 def getbundle(self,
               source,
               heads=None,
               common=None,
               bundlecaps=None,
               **kwargs):
     self.requirecap('getbundle', _('look up remote changes'))
     opts = {}
     if heads is not None:
         opts['heads'] = encodelist(heads)
     if common is not None:
         opts['common'] = encodelist(common)
     if bundlecaps is not None:
         opts['bundlecaps'] = ','.join(bundlecaps)
     opts.update(kwargs)
     f = self._callcompressable("getbundle", **opts)
     if bundlecaps is not None and 'HG2X' in bundlecaps:
         return bundle2.unbundle20(self.ui, f)
     else:
         return changegroupmod.unbundle10(f, 'UN')
Exemple #10
0
def handlechangegroup(op, inpart):
    """apply a changegroup part on the repo

    This is a very early implementation that will massive rework before being
    inflicted to any end-user.
    """
    # Make sure we trigger a transaction creation
    #
    # The addchangegroup function will get a transaction object by itself, but
    # we need to make sure we trigger the creation of a transaction object used
    # for the whole processing scope.
    op.gettransaction()
    cg = changegroup.unbundle10(inpart, 'UN')
    ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2')
    op.records.add('changegroup', {'return': ret})
    if op.reply is not None:
        # This is definitly not the final form of this
        # return. But one need to start somewhere.
        part = op.reply.newpart('b2x:reply:changegroup')
        part.addparam('in-reply-to', str(inpart.id), mandatory=False)
        part.addparam('return', '%i' % ret, mandatory=False)
    assert not inpart.read()
def handlechangegroup(op, inpart):
    """apply a changegroup part on the repo

    This is a very early implementation that will massive rework before being
    inflicted to any end-user.
    """
    # Make sure we trigger a transaction creation
    #
    # The addchangegroup function will get a transaction object by itself, but
    # we need to make sure we trigger the creation of a transaction object used
    # for the whole processing scope.
    op.gettransaction()
    cg = changegroup.unbundle10(inpart, 'UN')
    ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2')
    op.records.add('changegroup', {'return': ret})
    if op.reply is not None:
        # This is definitly not the final form of this
        # return. But one need to start somewhere.
        part = op.reply.newpart('b2x:reply:changegroup')
        part.addparam('in-reply-to', str(inpart.id), mandatory=False)
        part.addparam('return', '%i' % ret, mandatory=False)
    assert not inpart.read()
Exemple #12
0
 def getbundle(self, source, **kwargs):
     self.requirecap('getbundle', _('look up remote changes'))
     opts = {}
     for key, value in kwargs.iteritems():
         if value is None:
             continue
         keytype = gboptsmap.get(key)
         if keytype is None:
             assert False, 'unexpected'
         elif keytype == 'nodes':
             value = encodelist(value)
         elif keytype == 'csv':
             value = ','.join(value)
         elif keytype != 'plain':
             raise KeyError('unknown getbundle option type %s' % keytype)
         opts[key] = value
     f = self._callcompressable("getbundle", **opts)
     bundlecaps = kwargs.get('bundlecaps')
     if bundlecaps is not None and 'HG2X' in bundlecaps:
         return bundle2.unbundle20(self.ui, f)
     else:
         return changegroupmod.unbundle10(f, 'UN')
 def getbundle(self, source, **kwargs):
     self.requirecap('getbundle', _('look up remote changes'))
     opts = {}
     for key, value in kwargs.iteritems():
         if value is None:
             continue
         keytype = gboptsmap.get(key)
         if keytype is None:
             assert False, 'unexpected'
         elif keytype == 'nodes':
             value = encodelist(value)
         elif keytype == 'csv':
             value = ','.join(value)
         elif keytype != 'plain':
             raise KeyError('unknown getbundle option type %s'
                            % keytype)
         opts[key] = value
     f = self._callcompressable("getbundle", **opts)
     bundlecaps = kwargs.get('bundlecaps')
     if bundlecaps is not None and 'HG2X' in bundlecaps:
         return bundle2.unbundle20(self.ui, f)
     else:
         return changegroupmod.unbundle10(f, 'UN')
 def changegroup(self, nodes, kind):
     n = encodelist(nodes)
     f = self._callcompressable("changegroup", roots=n)
     return changegroupmod.unbundle10(f, 'UN')
 def changegroup(self, nodes, kind):
     n = encodelist(nodes)
     f = self._callstream("changegroup", roots=n)
     return changegroupmod.unbundle10(self._decompress(f), 'UN')
Exemple #16
0
 def changegroup(self, nodes, kind):
     n = encodelist(nodes)
     f = self._callstream("changegroup", roots=n)
     return changegroupmod.unbundle10(self._decompress(f), 'UN')
Exemple #17
0
 def changegroup(self, nodes, kind):
     n = encodelist(nodes)
     f = self._callcompressable("changegroup", roots=n)
     return changegroupmod.unbundle10(f, 'UN')