jj_lib/
lib.rs

1// Copyright 2020 The Jujutsu Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Jujutsu version control system.
16
17#![warn(missing_docs)]
18#![deny(unused_must_use)]
19#![forbid(unsafe_code)]
20
21// Needed so that proc macros can be used inside jj_lib and by external crates
22// that depend on it.
23// See:
24// - https://github.com/rust-lang/rust/issues/54647#issuecomment-432015102
25// - https://github.com/rust-lang/rust/issues/54363
26extern crate self as jj_lib;
27
28#[macro_use]
29pub mod content_hash;
30
31pub mod absorb;
32pub mod annotate;
33pub mod backend;
34pub mod bisect;
35pub mod commit;
36pub mod commit_builder;
37pub mod config;
38mod config_resolver;
39pub mod conflicts;
40pub mod copies;
41pub mod dag_walk;
42pub mod default_index;
43pub mod default_submodule_store;
44pub mod diff;
45pub mod diff_presentation;
46pub mod dsl_util;
47pub(crate) mod eol;
48pub mod evolution;
49pub mod extensions_map;
50pub mod file_util;
51pub mod files;
52pub mod fileset;
53mod fileset_parser;
54pub mod fix;
55pub mod fmt_util;
56pub mod fsmonitor;
57#[cfg(feature = "git")]
58pub mod git;
59#[cfg(feature = "git")]
60pub mod git_backend;
61#[cfg(feature = "git")]
62mod git_subprocess;
63pub mod gitignore;
64pub mod gpg_signing;
65pub mod graph;
66pub mod hex_util;
67pub mod id_prefix;
68pub mod index;
69pub mod iter_util;
70pub mod local_working_copy;
71pub mod lock;
72pub mod matchers;
73pub mod merge;
74pub mod merged_tree;
75pub mod object_id;
76pub mod op_heads_store;
77pub mod op_store;
78pub mod op_walk;
79pub mod operation;
80#[expect(missing_docs)]
81pub mod protos;
82pub mod ref_name;
83pub mod refs;
84pub mod repo;
85pub mod repo_path;
86pub mod revset;
87mod revset_parser;
88pub mod rewrite;
89#[cfg(feature = "testing")]
90pub mod secret_backend;
91pub mod settings;
92pub mod signing;
93pub mod tree_merge;
94// TODO: This file is mostly used for testing, whenever we no longer require it
95// in the lib it should be moved to the examples (e.g
96// "examples/simple-backend/").
97pub mod simple_backend;
98pub mod simple_op_heads_store;
99pub mod simple_op_store;
100pub mod ssh_signing;
101pub mod stacked_table;
102pub mod store;
103pub mod str_util;
104pub mod submodule_store;
105#[cfg(feature = "testing")]
106pub mod test_signing_backend;
107pub mod time_util;
108pub mod trailer;
109pub mod transaction;
110pub mod tree;
111pub mod tree_builder;
112pub mod union_find;
113pub mod view;
114pub mod working_copy;
115pub mod workspace;
116
117#[cfg(test)]
118mod tests {
119    use tempfile::TempDir;
120
121    /// Unlike `testutils::new_temp_dir()`, this function doesn't set up
122    /// hermetic Git environment.
123    pub fn new_temp_dir() -> TempDir {
124        tempfile::Builder::new()
125            .prefix("jj-test-")
126            .tempdir()
127            .unwrap()
128    }
129}