def test_simple(self): c1, c2, c3 = build_commit_graph(self.repo.object_store, [[1], [2, 1], [3, 1, 2]]) self.repo.refs[b"refs/heads/master"] = c3.id out = BytesIO() err = BytesIO() porcelain.archive(self.repo.path, b"refs/heads/master", outstream=out, errstream=err) self.assertEqual(b"", err.getvalue()) tf = tarfile.TarFile(fileobj=out) self.addCleanup(tf.close) self.assertEqual([], tf.getnames())
def test_simple(self): # TODO(jelmer): Remove this once dulwich has its own implementation of archive. require_git_version((1, 5, 0)) c1, c2, c3 = build_commit_graph(self.repo.object_store, [[1], [2, 1], [3, 1, 2]]) self.repo.refs["refs/heads/master"] = c3.id out = BytesIO() err = BytesIO() porcelain.archive(self.repo.path, "refs/heads/master", outstream=out, errstream=err) self.assertEqual("", err.getvalue()) tf = tarfile.TarFile(fileobj=out) self.addCleanup(tf.close) self.assertEqual([], tf.getnames())
def test_simple(self): # TODO(jelmer): Remove this once dulwich has its own implementation of archive. require_git_version((1, 5, 0)) c1, c2, c3 = build_commit_graph(self.repo.object_store, [[1], [2, 1], [3, 1, 2]]) self.repo.refs[b"refs/heads/master"] = c3.id out = BytesIO() err = BytesIO() porcelain.archive(self.repo.path, b"refs/heads/master", outstream=out, errstream=err) self.assertEqual(b"", err.getvalue()) tf = tarfile.TarFile(fileobj=out) self.addCleanup(tf.close) self.assertEqual([], tf.getnames())
def run(self, args): parser = optparse.OptionParser() parser.add_option("--remote", type=str, help="Retrieve archive from specified remote repo") options, args = parser.parse_args(args) committish = args.pop(0) if options.remote: client, path = get_transport_and_path(options.remote) client.archive( path, committish, sys.stdout.write, write_error=sys.stderr.write) else: porcelain.archive( '.', committish, outstream=sys.stdout, errstream=sys.stderr)
def run(self, args): parser = argparse.ArgumentParser() parser.add_argument( "--remote", type=str, help="Retrieve archive from specified remote repo", ) parser.add_argument('committish', type=str, nargs='?') args = parser.parse_args(args) if args.remote: client, path = get_transport_and_path(args.remote) client.archive( path, args.committish, sys.stdout.write, write_error=sys.stderr.write, ) else: porcelain.archive( ".", args.committish, outstream=sys.stdout.buffer, errstream=sys.stderr )