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 mod extensions_map;
46pub mod file_util;
47pub mod files;
48pub mod fileset;
49mod fileset_parser;
50pub mod fmt_util;
51pub mod fsmonitor;
52#[cfg(feature = "git")]
53pub mod git;
54#[cfg(not(feature = "git"))]
55/// A stub module that provides a no-op implementation of some of the functions
56/// in the `git` module.
57pub mod git {
58    /// Determine, by its name, if a remote refers to the special local-only
59    /// "git" remote that is used in the Git backend.
60    ///
61    /// This function always returns false if the "git" feature is not enabled.
62    pub fn is_special_git_remote(_remote: &str) -> bool {
63        false
64    }
65}
66#[cfg(feature = "git")]
67pub mod git_backend;
68#[cfg(feature = "git")]
69mod git_subprocess;
70pub mod gitignore;
71pub mod gpg_signing;
72pub mod graph;
73pub mod hex_util;
74pub mod id_prefix;
75pub mod index;
76pub mod local_backend;
77pub mod local_working_copy;
78pub mod lock;
79pub mod matchers;
80pub mod merge;
81pub mod merged_tree;
82pub mod object_id;
83pub mod op_heads_store;
84pub mod op_store;
85pub mod op_walk;
86pub mod operation;
87#[allow(missing_docs)]
88pub mod protos;
89pub mod refs;
90pub mod repo;
91pub mod repo_path;
92pub mod revset;
93mod revset_parser;
94pub mod rewrite;
95#[cfg(feature = "testing")]
96pub mod secret_backend;
97pub mod settings;
98pub mod signing;
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 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 libgit2 environment.
123    pub fn new_temp_dir() -> TempDir {
124        tempfile::Builder::new()
125            .prefix("jj-test-")
126            .tempdir()
127            .unwrap()
128    }
129}