navid/veins / commit
33195a6041ba
Navid M <navidmomtahen@gmail.com> · 2026-11-26
parents: bdbb60b4f08a
Browse files at this commit · Download source
--- a/veins/src/cli/resolve_cmd.sx+++ b/veins/src/cli/resolve_cmd.sx@@ -1,37 +1,37 @@ /// `vn xs` and `vn resolve`. -val str = use("std/string")-val stdio = use("std/stdio")-val msg = use("../core/msg.sx")-val bytes = use("../core/bytes.sx")-val buf = use("../core/buf.sx")-val lists = use("../core/lists.sx")-val prim = use("../core/primitives.sx")-val objid = use("../object/id.sx")-val types = use("../object/types.sx")-val tree = use("../object/tree.sx")-val commit = use("../object/commit.sx")-val conflict = use("../object/conflict.sx")-val blob = use("../object/blob.sx")-val graph = use("../object/graph.sx")-val treewalk = use("../object/treewalk.sx")-val state = use("../store/state.sx")-val store = use("../store/store.sx")-val layout = use("../store/layout.sx")-val txnmod = use("../store/txn.sx")-val viewops = use("../store/viewops.sx")-val view = use("../object/view.sx")-val identity = use("../core/identity.sx")-val repoconfig = use("../core/repoconfig.sx")-val files = use("../io/files.sx")-val stat = use("../io/stat.sx")-val pathspec = use("../worktree/pathspec.sx")-val snapshot = use("../worktree/snapshot.sx")-val checkout = use("../worktree/checkout.sx")-val treeedit = use("../worktree/treeedit.sx")-val object = use("../git/object.sx")-val raw = use("../object/raw.sx")-val filemerge = use("../merge/filemerge.sx")+val str = use("std/string")+val stdio = use("std/stdio")+val msg = use("../core/msg.sx")+val bytes = use("../core/bytes.sx")+val buf = use("../core/buf.sx")+val lists = use("../core/lists.sx")+val prim = use("../core/primitives.sx")+val objid = use("../object/id.sx")+val types = use("../object/types.sx")+val tree = use("../object/tree.sx")+val commit = use("../object/commit.sx")+val conflict = use("../object/conflict.sx")+val blob = use("../object/blob.sx")+val graph = use("../object/graph.sx")+val treewalk = use("../object/treewalk.sx")+val state = use("../store/state.sx")+val store = use("../store/store.sx")+val layout = use("../store/layout.sx")+val txnmod = use("../store/txn.sx")+val viewops = use("../store/viewops.sx")+val view = use("../object/view.sx")+val identity = use("../core/identity.sx")+val repoconfig = use("../core/repoconfig.sx")+val files = use("../io/files.sx")+val stat = use("../io/stat.sx")+val pathspec = use("../worktree/pathspec.sx")+val snapshot = use("../worktree/snapshot.sx")+val checkout = use("../worktree/checkout.sx")+val treeedit = use("../worktree/treeedit.sx")+val object = use("../git/object.sx")+val raw = use("../object/raw.sx")+val filemerge = use("../merge/filemerge.sx") val resolutions = use("../merge/resolutions.sx") extern (C) fn system(command: ref u8) i32 = "system"--- a/veins/src/merge/algebra.sx+++ b/veins/src/merge/algebra.sx@@ -148,7 +148,11 @@ @listfree(vals) } -fn find_cancel(adds: list[ref conflict.ConflictValue], used: ref u8, v: ref conflict.ConflictValue) i32 = trust {+fn find_cancel(+ adds: list[ref conflict.ConflictValue],+ used: ref u8,+ v: ref conflict.ConflictValue+) i32 = trust { val i: mut usize = 0 for i < @len(adds) { val used_flag: u8 = @load8(@ptradd(used, i as i64))--- a/veins/src/merge/engine.sx+++ b/veins/src/merge/engine.sx@@ -1,14 +1,14 @@ /// Merge-base selection and helpers that turn commit-level merges into the /// signed tree terms consumed by `treemerge`. -val lists = use("../core/lists.sx")-val objid = use("../object/id.sx")-val graph = use("../object/graph.sx")-val store = use("../store/store.sx")-val txnmod = use("../store/txn.sx")-val layout = use("../store/layout.sx")-val object = use("../git/object.sx")-val rename = use("rename.sx")+val lists = use("../core/lists.sx")+val objid = use("../object/id.sx")+val graph = use("../object/graph.sx")+val store = use("../store/store.sx")+val txnmod = use("../store/txn.sx")+val layout = use("../store/layout.sx")+val object = use("../git/object.sx")+val rename = use("rename.sx") val treemerge = use("treemerge.sx") pub fn tree_of(handles: list[ref store.Handle], id: objid.Id) option[objid.Id] = trust {@@ -49,7 +49,11 @@ } /// Common ancestors that are not ancestors of another common ancestor.-pub fn merge_bases(handles: list[ref store.Handle], a: objid.Id, b: objid.Id) list[objid.Id] = trust {+pub fn merge_bases(+ handles: list[ref store.Handle],+ a: objid.Id,+ b: objid.Id+) list[objid.Id] = trust { val aa: list[objid.Id] = graph.collect(handles, single(a)) val bb: list[objid.Id] = graph.collect(handles, single(b)) val common: mut list[objid.Id] = lists.new[objid.Id]()--- a/veins/src/merge/filemerge.sx+++ b/veins/src/merge/filemerge.sx@@ -4,16 +4,16 @@ /// Binary detection is performed by the caller; this module only deals with /// text. Line buffers are borrowed from the caller's blob data. -val bytes = use("../core/bytes.sx")-val buf = use("../core/buf.sx")-val lists = use("../core/lists.sx")-val objid = use("../object/id.sx")-val blob = use("../object/blob.sx")+val bytes = use("../core/bytes.sx")+val buf = use("../core/buf.sx")+val lists = use("../core/lists.sx")+val objid = use("../object/id.sx")+val blob = use("../object/blob.sx") val content = use("../object/content.sx")-val store = use("../store/store.sx")-val raw = use("../object/raw.sx")-val txnmod = use("../store/txn.sx")-val object = use("../git/object.sx")+val store = use("../store/store.sx")+val raw = use("../object/raw.sx")+val txnmod = use("../store/txn.sx")+val object = use("../git/object.sx") pub val OP_CONTEXT: u8 = 32 pub val OP_ADD: u8 = 43--- a/veins/src/merge/rename.sx+++ b/veins/src/merge/rename.sx@@ -520,7 +520,15 @@ ae.path, de.target, ae.target,- similarity(handles, git, has_git, de.target, ae.target, use_cache, tx)+ similarity(+ handles,+ git,+ has_git,+ de.target,+ ae.target,+ use_cache,+ tx+ ) ) ) }--- a/veins/src/merge/treemerge.sx+++ b/veins/src/merge/treemerge.sx@@ -1,22 +1,22 @@ /// Tree-level merge: flatten signed tree terms, apply renames, merge each path, /// and rebuild a canonical tree. -val bytes = use("../core/bytes.sx")-val lists = use("../core/lists.sx")-val objid = use("../object/id.sx")-val types = use("../object/types.sx")-val tree = use("../object/tree.sx")-val treewalk = use("../object/treewalk.sx")-val conflict = use("../object/conflict.sx")-val store = use("../store/store.sx")-val txnmod = use("../store/txn.sx")-val layout = use("../store/layout.sx")-val object = use("../git/object.sx")-val algebra = use("algebra.sx")-val filemerge = use("filemerge.sx")-val rename = use("rename.sx")+val bytes = use("../core/bytes.sx")+val lists = use("../core/lists.sx")+val objid = use("../object/id.sx")+val types = use("../object/types.sx")+val tree = use("../object/tree.sx")+val treewalk = use("../object/treewalk.sx")+val conflict = use("../object/conflict.sx")+val store = use("../store/store.sx")+val txnmod = use("../store/txn.sx")+val layout = use("../store/layout.sx")+val object = use("../git/object.sx")+val algebra = use("algebra.sx")+val filemerge = use("filemerge.sx")+val rename = use("rename.sx") val resolutions = use("resolutions.sx")-val attributes = use("attributes.sx")+val attributes = use("attributes.sx") pub type TreeTerm = { positive: mut bool@@ -121,7 +121,8 @@ return none } -fn has_prefix(path: bytes.Bytes, prefix: bytes.Bytes) bool = trust { if path.len <= prefix.len {+fn has_prefix(path: bytes.Bytes, prefix: bytes.Bytes) bool = trust {+ if path.len <= prefix.len { return false } if !bytes.Bytes.starts_with(path, prefix) {@@ -354,19 +355,19 @@ if m is some mm { if mm != none { val t = rename.lookup(mm, path)- if t is some dest {- val exists: mut bool = false- for c in out {- if bytes.Bytes.eql(c.target, dest) {- exists = true+ if t is some dest {+ val exists: mut bool = false+ for c in out {+ if bytes.Bytes.eql(c.target, dest) {+ exists = true+ } }- }- if !exists {- val c: mut ref CanonTarget = @alloc(@sizeof(CanonTarget)) as ref CanonTarget- c.map_index = i- c.target = bytes.Bytes.dup(dest)- @append(out, c)- }+ if !exists {+ val c: mut ref CanonTarget = @alloc(@sizeof(CanonTarget)) as ref CanonTarget+ c.map_index = i+ c.target = bytes.Bytes.dup(dest)+ @append(out, c)+ } } } }@@ -417,7 +418,10 @@ } } -fn all_files(adds: list[ref conflict.ConflictValue], removes: list[ref conflict.ConflictValue]) bool = trust {+fn all_files(+ adds: list[ref conflict.ConflictValue],+ removes: list[ref conflict.ConflictValue]+) bool = trust { for v in adds { if v.kind != tree.KIND_FILE && v.kind != tree.KIND_EXECUTABLE { if v.kind != 0 {@@ -643,7 +647,11 @@ return false } -fn exact_entry(canon: list[ref OrigEntry], term: usize, path: bytes.Bytes) option[ref OrigEntry] = trust {+fn exact_entry(+ canon: list[ref OrigEntry],+ term: usize,+ path: bytes.Bytes+) option[ref OrigEntry] = trust { for e in canon { if e.term == term && bytes.Bytes.eql(e.path, path) { return some e--- a/veins/src/object/treewalk.sx+++ b/veins/src/object/treewalk.sx@@ -1,13 +1,13 @@ /// Helpers for reading, flattening, and comparing tree objects. -val bytes = use("../core/bytes.sx")-val lists = use("../core/lists.sx")-val objid = use("../object/id.sx")-val types = use("../object/types.sx")-val tree = use("../object/tree.sx")-val read = use("../store/state.sx")-val store = use("../store/store.sx")-val files = use("../io/files.sx")+val bytes = use("../core/bytes.sx")+val lists = use("../core/lists.sx")+val objid = use("../object/id.sx")+val types = use("../object/types.sx")+val tree = use("../object/tree.sx")+val read = use("../store/state.sx")+val store = use("../store/store.sx")+val files = use("../io/files.sx") val txnmod = use("../store/txn.sx") pub val KIND_MISSING: u8 = 0--- a/veins/src/worktree/snapshot.sx+++ b/veins/src/worktree/snapshot.sx@@ -5,38 +5,38 @@ /// message and is amended in place. A snapshot that produces the same tree as /// the existing commit does not create an operation. -val str = use("std/string")-val stdio = use("std/stdio")-val msg = use("../core/msg.sx")-val time = use("std/time")-val bytes = use("../core/bytes.sx")-val buf = use("../core/buf.sx")-val reader = use("../core/reader.sx")-val lists = use("../core/lists.sx")-val prim = use("../core/primitives.sx")-val random = use("std/crypto/random")-val objid = use("../object/id.sx")-val types = use("../object/types.sx")-val tree = use("../object/tree.sx")-val commit = use("../object/commit.sx")-val blob = use("../object/blob.sx")-val treewalk = use("../object/treewalk.sx")-val store = use("../store/store.sx")-val layout = use("../store/layout.sx")-val state = use("../store/state.sx")-val txn = use("../store/txn.sx")-val viewops = use("../store/viewops.sx")-val identity = use("../core/identity.sx")-val gitmap = use("../git/map.sx")-val renamemod = use("../merge/rename.sx")-val object = use("../git/object.sx")+val str = use("std/string")+val stdio = use("std/stdio")+val msg = use("../core/msg.sx")+val time = use("std/time")+val bytes = use("../core/bytes.sx")+val buf = use("../core/buf.sx")+val reader = use("../core/reader.sx")+val lists = use("../core/lists.sx")+val prim = use("../core/primitives.sx")+val random = use("std/crypto/random")+val objid = use("../object/id.sx")+val types = use("../object/types.sx")+val tree = use("../object/tree.sx")+val commit = use("../object/commit.sx")+val blob = use("../object/blob.sx")+val treewalk = use("../object/treewalk.sx")+val store = use("../store/store.sx")+val layout = use("../store/layout.sx")+val state = use("../store/state.sx")+val txn = use("../store/txn.sx")+val viewops = use("../store/viewops.sx")+val identity = use("../core/identity.sx")+val gitmap = use("../git/map.sx")+val renamemod = use("../merge/rename.sx")+val object = use("../git/object.sx") val repoconfig = use("../core/repoconfig.sx")-val view = use("../object/view.sx")-val files = use("../io/files.sx")-val native = use("../io/native.sx")-val stat = use("../io/stat.sx")-val raw = use("../object/raw.sx")-val ignore = use("ignore.sx")+val view = use("../object/view.sx")+val files = use("../io/files.sx")+val native = use("../io/native.sx")+val stat = use("../io/stat.sx")+val raw = use("../object/raw.sx")+val ignore = use("ignore.sx") type CacheEntry = { path: mut bytes.Bytes@@ -498,7 +498,10 @@ val digits: usize = trailing_digits(name) if digits > 0 { val stem_end: usize = name.len - digits- if stem_end > 5 && ends_with(bytes.Bytes.slice(name, 0, stem_end), bytes.bytes(c".base", 5)) {+ if stem_end > 5 && ends_with(+ bytes.Bytes.slice(name, 0, stem_end),+ bytes.bytes(c".base", 5)+ ) { return some bytes.Bytes.slice(name, 0, stem_end - 5) } if stem_end > 7