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 conflict_labels;
40pub mod conflicts;
41pub mod copies;
42pub mod dag_walk;
43pub mod default_index;
44pub mod default_submodule_store;
45pub mod diff;
46pub mod diff_presentation;
47pub mod dsl_util;
48pub(crate) mod eol;
49pub mod evolution;
50pub mod extensions_map;
51pub mod file_util;
52pub mod files;
53pub mod fileset;
54mod fileset_parser;
55pub mod fix;
56pub mod fmt_util;
57pub mod fsmonitor;
58#[cfg(feature = "git")]
59pub mod git;
60#[cfg(feature = "git")]
61pub mod git_backend;
62#[cfg(feature = "git")]
63mod git_subprocess;
64pub mod gitignore;
65pub mod gpg_signing;
66pub mod graph;
67pub mod hex_util;
68pub mod id_prefix;
69pub mod index;
70pub mod iter_util;
71pub mod local_working_copy;
72pub mod lock;
73pub mod matchers;
74pub mod merge;
75pub mod merged_tree;
76pub mod object_id;
77pub mod op_heads_store;
78pub mod op_store;
79pub mod op_walk;
80pub mod operation;
81#[expect(missing_docs)]
82pub mod protos;
83pub mod ref_name;
84pub mod refs;
85pub mod repo;
86pub mod repo_path;
87pub mod revset;
88mod revset_parser;
89pub mod rewrite;
90#[cfg(feature = "testing")]
91pub mod secret_backend;
92pub mod settings;
93pub mod signing;
94pub mod tree_merge;
95// TODO: This file is mostly used for testing, whenever we no longer require it
96// in the lib it should be moved to the examples (e.g
97// "examples/simple-backend/").
98pub mod simple_backend;
99pub mod simple_op_heads_store;
100pub mod simple_op_store;
101pub mod ssh_signing;
102pub mod stacked_table;
103pub mod store;
104pub mod str_util;
105pub mod submodule_store;
106#[cfg(feature = "testing")]
107pub mod test_signing_backend;
108pub mod time_util;
109pub mod trailer;
110pub mod transaction;
111pub mod tree;
112pub mod tree_builder;
113pub mod union_find;
114pub mod view;
115pub mod working_copy;
116pub mod workspace;
117
118#[cfg(test)]
119mod tests {
120    use tempfile::TempDir;
121
122    /// Unlike `testutils::new_temp_dir()`, this function doesn't set up
123    /// hermetic Git environment.
124    pub fn new_temp_dir() -> TempDir {
125        tempfile::Builder::new()
126            .prefix("jj-test-")
127            .tempdir()
128            .unwrap()
129    }
130}