~ubuntu-branches/ubuntu/precise/mercurial/precise-updates

« back to all changes in this revision

Viewing changes to mercurial/sshrepo.py

  • Committer: Bazaar Package Importer
  • Author(s): Vincent Danjean, Javi Merino, Vincent Danjean
  • Date: 2010-07-04 09:55:28 UTC
  • mfrom: (1.2.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20100704095528-bzag1mhfylss9zth
Tags: 1.6-1
[ Javi Merino ]
* New upstream release (1.6). Many bug fixes and improvements. Among
    them:
  - push: break infinite http recursion bug with Python 2.6.5
       (issue2179 and issue2255) (Closes: #586907)
  - zeroconf: Don't use string exceptions (Closes: #585250)
* Removed patch for_upstream__bashism_in_examples.patch since a fix for
    #581122 is included upstream.
* Updated Standards-Version to 3.9 (no change needed)

[ Vincent Danjean ]
* debian/control:
  + Use Breaks instead of Conflicts
  + Use a fixed version in Replaces
    I put 1.4 but it has been a long time since nothing has been moved
    from mercurial to mercurial-common

Show diffs side-by-side

added added

removed removed

Lines of Context:
117
117
    def do_cmd(self, cmd, **args):
118
118
        self.ui.debug("sending %s command\n" % cmd)
119
119
        self.pipeo.write("%s\n" % cmd)
120
 
        for k, v in args.iteritems():
 
120
        for k, v in sorted(args.iteritems()):
121
121
            self.pipeo.write("%s %d\n" % (k, len(v)))
122
122
            self.pipeo.write(v)
123
123
        self.pipeo.flush()
217
217
        return self.do_cmd("changegroupsubset", bases=bases, heads=heads)
218
218
 
219
219
    def unbundle(self, cg, heads, source):
 
220
        '''Send cg (a readable file-like object representing the
 
221
        changegroup to push, typically a chunkbuffer object) to the
 
222
        remote server as a bundle. Return an integer indicating the
 
223
        result of the push (see localrepository.addchangegroup()).'''
220
224
        d = self.call("unbundle", heads=' '.join(map(hex, heads)))
221
225
        if d:
222
226
            # remote may send "unsynced changes"
242
246
            self.abort(error.ResponseError(_("unexpected response:"), r))
243
247
 
244
248
    def addchangegroup(self, cg, source, url):
 
249
        '''Send a changegroup to the remote server.  Return an integer
 
250
        similar to unbundle(). DEPRECATED, since it requires locking the
 
251
        remote.'''
245
252
        d = self.call("addchangegroup")
246
253
        if d:
247
254
            self.abort(error.RepoError(_("push refused: %s") % d))
266
273
    def stream_out(self):
267
274
        return self.do_cmd('stream_out')
268
275
 
 
276
    def pushkey(self, namespace, key, old, new):
 
277
        if not self.capable('pushkey'):
 
278
            return False
 
279
        d = self.call("pushkey",
 
280
                      namespace=namespace, key=key, old=old, new=new)
 
281
        return bool(int(d))
 
282
 
 
283
    def listkeys(self, namespace):
 
284
        if not self.capable('pushkey'):
 
285
            return {}
 
286
        d = self.call("listkeys", namespace=namespace)
 
287
        r = {}
 
288
        for l in d.splitlines():
 
289
            k, v = l.split('\t')
 
290
            r[k.decode('string-escape')] = v.decode('string-escape')
 
291
        return r
 
292
 
269
293
instance = sshrepository