MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / upsert_code_project

Method upsert_code_project

src/global_db.rs:1232–1274  ·  view source on GitHub ↗
(
        &self,
        project_id: &str,
        project_root: &Path,
        git_common_dir: Option<&Path>,
        git_remote_url: Option<&str>,
        default_branch: Option<&str>,
    )

Source from the content-addressed store, hash-verified

1230 }
1231
1232 pub async fn upsert_code_project(
1233 &self,
1234 project_id: &str,
1235 project_root: &Path,
1236 git_common_dir: Option<&Path>,
1237 git_remote_url: Option<&str>,
1238 default_branch: Option<&str>,
1239 ) -> Option<CodeProjectRecord> {
1240 let now = crate::tracedecay::current_timestamp();
1241 let canonical_root = Self::canonical_project_key(project_root);
1242 let display_root = project_root.to_string_lossy().to_string();
1243 let git_common_dir_text = git_common_dir.map(|path| path.to_string_lossy().to_string());
1244 self.conn
1245 .execute(
1246 "INSERT INTO code_projects
1247 (project_id, canonical_root, display_root, git_common_dir, git_remote_url,
1248 default_branch, created_at, last_seen_at)
1249 VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?7)
1250 ON CONFLICT(project_id) DO UPDATE SET
1251 canonical_root = excluded.canonical_root,
1252 display_root = excluded.display_root,
1253 git_common_dir = excluded.git_common_dir,
1254 git_remote_url = excluded.git_remote_url,
1255 default_branch = excluded.default_branch,
1256 last_seen_at = excluded.last_seen_at",
1257 params![
1258 project_id,
1259 canonical_root,
1260 display_root,
1261 opt_text(git_common_dir_text.as_deref()),
1262 opt_text(git_remote_url),
1263 opt_text(default_branch),
1264 now,
1265 ],
1266 )
1267 .await
1268 .ok()?;
1269 self.upsert_project_alias(project_root, project_id).await?;
1270 for alias in repo_identity_aliases(git_common_dir) {
1271 self.upsert_project_alias_key(&alias, project_id).await?;
1272 }
1273 self.get_code_project(project_id).await
1274 }
1275
1276 pub async fn upsert_project_alias(
1277 &self,

Calls 5

current_timestampFunction · 0.85
repo_identity_aliasesFunction · 0.85
upsert_project_aliasMethod · 0.80
get_code_projectMethod · 0.80