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