changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / rust/lib/obj/src/config/repo.rs

changeset 698: 96958d3eb5b0
parent: c7165d93a9eb
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 //! cfg::config::repo
2 //!
3 //! Repo configuration primitives
4 use serde::{Deserialize, Serialize};
5 use std::path::PathBuf;
6 #[cfg(feature = "git")]
7 pub mod git;
8 #[cfg(feature = "hg")]
9 pub mod hg;
10 /// Generic repo configuration type
11 ///
12 /// Wraps Mercurial and Git repos
13 #[derive(Serialize, Deserialize, Debug, Hash, PartialEq)]
14 pub struct RepoConfig {
15  pub vcs: String,
16  pub origin: String,
17  pub path: PathBuf,
18 }
19 
20 impl RepoConfig {
21  /// Create a new RepoConfig
22  pub fn new() -> Self {
23  RepoConfig::default()
24  }
25 }
26 
27 impl Default for RepoConfig {
28  fn default() -> Self {
29  RepoConfig {
30  vcs: "hg".to_string(),
31  origin: "".to_string(),
32  path: PathBuf::from("."),
33  }
34  }
35 }
36 
37 /// Subrepo type
38 ///
39 /// Note that Mercurial subrepos are a 'feature of last resort'
40 /// according to official docs. They are needed in very niche
41 /// scenarios and shouldn't be used most of the time.
42 #[derive(Default)]
43 pub struct SubRepo {
44  pub vcs: String,
45  pub origin: String,
46  pub path: String,
47 }