def test_outgoing_output(self):
     self._load_fixture_and_fetch('two_heads.svndump')
     u = self.ui()
     parents = (self.repo['the_branch'].node(), revlog.nullid, )
     def filectxfn(repo, memctx, path):
         return context.memfilectx(path=path,
                                   data='added',
                                   islink=False,
                                   isexec=False,
                                   copied=False)
     ctx = context.memctx(self.repo,
                          parents,
                          'automated test',
                          ['added_bogus_file', 'other_added_file', ],
                          filectxfn,
                          'testy',
                          '2008-12-21 16:32:00 -0500',
                          {'branch': 'localbranch', })
     new = self.repo.commitctx(ctx)
     hg.update(self.repo, new)
     u.pushbuffer()
     commands.outgoing(u, self.repo, self.repourl)
     actual = u.popbuffer()
     self.assertTrue(node.hex(self.repo['localbranch'].node())[:8] in actual)
     self.assertEqual(actual.strip(), '5:6de15430fa20')
     hg.update(self.repo, 'default')
     u.pushbuffer()
     commands.outgoing(u, self.repo, self.repourl)
     actual = u.popbuffer()
     self.assertEqual(actual, '')
Beispiel #2
0
 def function(tree, destpath, opts):
     if not destpath:
         destpath = forest.top().getpath(dest)
         if destpath:
             rpath = util.pconvert(relpath(forest.top().root, tree.root))
             destpath = '/'.join((destpath, rpath))
         else:
             ui.warn(_("skipped: %s\n") %
                     _("repository %s not found") % dest[0])
             return
     try:
         commands.outgoing(ui, tree.repo, destpath, **opts)
     except Exception, err:
         ui.warn(_("skipped: %s\n") % err)
    def test_outgoing_output(self):
        repo, repo_path = self.load_and_fetch('two_heads.svndump')
        u = self.ui()
        parents = (
            revsymbol(self.repo, 'the_branch').node(),
            revlog.nullid,
        )

        def filectxfn(repo, memctx, path):
            return compathacks.makememfilectx(repo,
                                              memctx=memctx,
                                              path=path,
                                              data='added',
                                              islink=False,
                                              isexec=False,
                                              copied=False)

        lr = self.repo
        ctx = context.memctx(lr, parents, 'automated test', [
            'added_bogus_file',
            'other_added_file',
        ], filectxfn, 'testy', '2008-12-21 16:32:00 -0500', {
            'branch': 'localbranch',
        })
        new = lr.commitctx(ctx)
        hg.update(self.repo, new)
        u.pushbuffer()
        commands.outgoing(u, self.repo, repourl(repo_path))
        actual = u.popbuffer()
        self.assertTrue(
            node.hex(revsymbol(self.repo, 'localbranch').node())[:8] in actual)
        # two hashes for compat with hg < 4.8
        self.assertTrue(actual.strip() in ('5:6de15430fa20', '5:76670ad282fd'))
        hg.update(self.repo, revsymbol(self.repo, 'default'))
        u.pushbuffer()
        commands.outgoing(u, self.repo, repourl(repo_path))
        actual = u.popbuffer()
        self.assertEqual(actual, '')