Embed git commit hash in the document file (#1325)
* Embed git commit hash in the document file * Bump version in test document file * Fixes --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
8bdc64bb8b
commit
a49d96ed37
|
|
@ -28,6 +28,8 @@ pub struct Document {
|
||||||
pub state_identifier: DefaultHasher,
|
pub state_identifier: DefaultHasher,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub document_network: graph_craft::document::NodeNetwork,
|
pub document_network: graph_craft::document::NodeNetwork,
|
||||||
|
#[serde(default)]
|
||||||
|
pub commit_hash: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PartialEq for Document {
|
impl PartialEq for Document {
|
||||||
|
|
@ -54,6 +56,7 @@ impl Default for Document {
|
||||||
network.push_node(node, false);
|
network.push_node(node, false);
|
||||||
network
|
network
|
||||||
},
|
},
|
||||||
|
commit_hash: String::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -79,7 +79,7 @@ pub const DEFAULT_FONT_FAMILY: &str = "Merriweather";
|
||||||
pub const DEFAULT_FONT_STYLE: &str = "Normal (400)";
|
pub const DEFAULT_FONT_STYLE: &str = "Normal (400)";
|
||||||
|
|
||||||
// Document
|
// Document
|
||||||
pub const GRAPHITE_DOCUMENT_VERSION: &str = "0.0.16"; // Remember to save a simple document and replace the test file `graphite-test-document.graphite`
|
pub const GRAPHITE_DOCUMENT_VERSION: &str = "0.0.17"; // Remember to save a simple document and replace the test file `graphite-test-document.graphite`
|
||||||
pub const DEFAULT_DOCUMENT_NAME: &str = "Untitled Document";
|
pub const DEFAULT_DOCUMENT_NAME: &str = "Untitled Document";
|
||||||
pub const FILE_SAVE_SUFFIX: &str = ".graphite";
|
pub const FILE_SAVE_SUFFIX: &str = ".graphite";
|
||||||
pub const MAX_UNDO_HISTORY_LEN: usize = 100; // TODO: Add this to user preferences
|
pub const MAX_UNDO_HISTORY_LEN: usize = 100; // TODO: Add this to user preferences
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,12 @@ pub struct DocumentMessageHandler {
|
||||||
|
|
||||||
impl Default for DocumentMessageHandler {
|
impl Default for DocumentMessageHandler {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
|
let document_legacy = DocumentLegacy {
|
||||||
|
commit_hash: crate::application::GRAPHITE_GIT_COMMIT_HASH.to_string(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
Self {
|
Self {
|
||||||
document_legacy: DocumentLegacy::default(),
|
document_legacy,
|
||||||
saved_document_identifier: 0,
|
saved_document_identifier: 0,
|
||||||
auto_saved_document_identifier: 0,
|
auto_saved_document_identifier: 0,
|
||||||
name: String::from("Untitled Document"),
|
name: String::from("Untitled Document"),
|
||||||
|
|
|
||||||
|
|
@ -317,6 +317,7 @@ impl MessageHandler<PortfolioMessage, (&InputPreprocessorMessageHandler, &Prefer
|
||||||
self.load_document(document, document_id, responses);
|
self.load_document(document, document_id, responses);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
println!("Failed to open document: {}", e);
|
||||||
if !document_is_auto_saved {
|
if !document_is_auto_saved {
|
||||||
responses.add(DialogMessage::DisplayDialogError {
|
responses.add(DialogMessage::DisplayDialogError {
|
||||||
title: "Failed to open document".to_string(),
|
title: "Failed to open document".to_string(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue