mercurial-devel | Failed pipeline for branch/stable | baf93d4e
Pipeline #27445 has failed! Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel ) Branch: branch/stable ( https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/stable ) Commit: baf93d4e ( https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/baf93d4e8181842c4ba06a8488c3613ead04e586 ) Commit Message: Added signature for changeset 750920b18aaa --H... Commit Author: Pulkit Goyal ( https://foss.heptapod.net/pulkit.goyal ) Pipeline #27445 ( https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/27445 ) triggered by Administrator ( https://foss.heptapod.net/root ) had 1 failed job. Job #251366 ( https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/251366/raw ) Stage: tests Name: check-pytype-py3 -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D11617: rhg: in rhg cat cli, fix the long name of the --rev flag\n\nAlso tweak the help for the anonymous argument.
aalekseyev created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11617 AFFECTED FILES rust/rhg/src/commands/cat.rs tests/test-rhg.t CHANGE DETAILS diff --git a/tests/test-rhg.t b/tests/test-rhg.t --- a/tests/test-rhg.t +++ b/tests/test-rhg.t @@ -121,6 +121,8 @@ file-3 $ $NO_FALLBACK rhg cat -r cf8b83 file-2 2 + $ $NO_FALLBACK rhg cat --rev cf8b83 file-2 + 2 $ $NO_FALLBACK rhg cat -r c file-2 abort: ambiguous revision identifier: c [255] diff --git a/rust/rhg/src/commands/cat.rs b/rust/rhg/src/commands/cat.rs --- a/rust/rhg/src/commands/cat.rs +++ b/rust/rhg/src/commands/cat.rs @@ -16,7 +16,7 @@ Arg::with_name("rev") .help("search the repository as it is in REV") .short("-r") -.long("--revision") +.long("--rev") .value_name("REV") .takes_value(true), ) @@ -26,7 +26,7 @@ .multiple(true) .empty_values(false) .value_name("FILE") -.help("Activity to start: activity@category"), +.help("Files to output"), ) .about(HELP_TEXT) } To: aalekseyev, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D11615: rhg: faster hg cat when many files are requested
aalekseyev created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11615 AFFECTED FILES rust/hg-core/src/operations/cat.rs rust/rhg/src/commands/cat.rs CHANGE DETAILS diff --git a/rust/rhg/src/commands/cat.rs b/rust/rhg/src/commands/cat.rs --- a/rust/rhg/src/commands/cat.rs +++ b/rust/rhg/src/commands/cat.rs @@ -59,7 +59,7 @@ match rev { Some(rev) => { -let output = cat(, rev, ).map_err(|e| (e, rev))?; +let output = cat(, rev, files).map_err(|e| (e, rev))?; invocation.ui.write_stdout()?; if !output.missing.is_empty() { let short = format!("{:x}", output.node.short()).into_bytes(); diff --git a/rust/hg-core/src/operations/cat.rs b/rust/hg-core/src/operations/cat.rs --- a/rust/hg-core/src/operations/cat.rs +++ b/rust/hg-core/src/operations/cat.rs @@ -11,6 +11,9 @@ use crate::utils::hg_path::HgPathBuf; +use itertools::EitherOrBoth::{Both, Left, Right}; +use itertools::Itertools; + pub struct CatOutput { /// Whether any file in the manifest matched the paths given as CLI /// arguments @@ -31,7 +34,7 @@ pub fn cat<'a>( repo: , revset: , -files: &'a [HgPathBuf], +mut files: Vec, ) -> Result { let rev = crate::revset::resolve_single(revset, repo)?; let manifest = repo.manifest_for_rev(rev)?; @@ -40,13 +43,21 @@ .node_from_rev(rev) .expect("should succeed when repo.manifest did"); let mut bytes = vec![]; -let mut matched = vec![false; files.len()]; let mut found_any = false; +files.sort_unstable(); + +let mut missing = vec![]; -for (manifest_file, node_bytes) in manifest.files_with_nodes() { -for (cat_file, is_matched) in files.iter().zip( matched) { -if cat_file.as_bytes() == manifest_file.as_bytes() { -*is_matched = true; +for entry in manifest +.files_with_nodes() +.merge_join_by(files.iter(), |(manifest_file, _), file| { +manifest_file.cmp(_ref()) +}) +{ +match entry { +Left(_) => (), +Right(path) => missing.push(path), +Both((manifest_file, node_bytes), _) => { found_any = true; let file_log = repo.filelog(manifest_file)?; let file_node = Node::from_hex_for_repo(node_bytes)?; @@ -56,11 +67,12 @@ } } +// make the order of the [missing] files +// match the order they were specified on the command line let missing: Vec<_> = files .iter() -.zip() -.filter(|pair| !*pair.1) -.map(|pair| pair.0.clone()) +.filter(|file| missing.contains(file)) +.map(|file| file.clone()) .collect(); Ok(CatOutput { found_any, To: aalekseyev, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D11616: rhg: stop manifest traversal when no more files are needed
aalekseyev created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11616 AFFECTED FILES rust/hg-core/src/operations/cat.rs CHANGE DETAILS diff --git a/rust/hg-core/src/operations/cat.rs b/rust/hg-core/src/operations/cat.rs --- a/rust/hg-core/src/operations/cat.rs +++ b/rust/hg-core/src/operations/cat.rs @@ -9,10 +9,12 @@ use crate::revlog::revlog::RevlogError; use crate::revlog::Node; +use crate::utils::hg_path::HgPath; use crate::utils::hg_path::HgPathBuf; -use itertools::EitherOrBoth::{Both, Left, Right}; -use itertools::Itertools; +use itertools::put_back; +use itertools::PutBack; +use std::cmp::Ordering; pub struct CatOutput { /// Whether any file in the manifest matched the paths given as CLI @@ -26,6 +28,50 @@ pub node: Node, } +// Find an item in an iterator over a sorted collection. +fn find_item<'a, 'b, 'c, D, I: Iterator>( +i: PutBack, +needle: &'b HgPath, +) -> Option { +loop { +match i.next() { +None => return None, +Some(val) => match needle.as_bytes().cmp(val.0.as_bytes()) { +Ordering::Less => { +i.put_back(val); +return None; +} +Ordering::Greater => continue, +Ordering::Equal => return Some(val), +}, +} +} +} + +fn find_files_in_manifest< +'a, +'b, +'c, +D, +I: Iterator, +J: Iterator, +>( +i: I, +j: J, +) -> (Vec<(&'a HgPath, D)>, Vec<&'b HgPath>) { +let mut manifest_iterator = put_back(i); +let mut res = vec![]; +let mut missing = vec![]; + +for file in j { +match find_item( manifest_iterator, file) { +None => missing.push(file), +Some(item) => res.push(item), +} +} +return (res, missing); +} + /// Output the given revision of files /// /// * `root`: Repository root @@ -42,36 +88,28 @@ .changelog()? .node_from_rev(rev) .expect("should succeed when repo.manifest did"); -let mut bytes = vec![]; +let mut bytes: Vec = vec![]; let mut found_any = false; + files.sort_unstable(); -let mut missing = vec![]; +let (found, missing) = find_files_in_manifest( +manifest.files_with_nodes(), +files.iter().map(|f| f.as_ref()), +); -for entry in manifest -.files_with_nodes() -.merge_join_by(files.iter(), |(manifest_file, _), file| { -manifest_file.cmp(_ref()) -}) -{ -match entry { -Left(_) => (), -Right(path) => missing.push(path), -Both((manifest_file, node_bytes), _) => { -found_any = true; -let file_log = repo.filelog(manifest_file)?; -let file_node = Node::from_hex_for_repo(node_bytes)?; -let entry = file_log.data_for_node(file_node)?; -bytes.extend(entry.data()?) -} -} +for (manifest_file, node_bytes) in found { +found_any = true; +let file_log = repo.filelog(manifest_file)?; +let file_node = Node::from_hex_for_repo(node_bytes)?; +bytes.extend(file_log.data_for_node(file_node)?.data()?); } // make the order of the [missing] files // match the order they were specified on the command line let missing: Vec<_> = files .iter() -.filter(|file| missing.contains(file)) +.filter(|file| missing.contains(_ref())) .map(|file| file.clone()) .collect(); Ok(CatOutput { To: aalekseyev, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D11613: rhg: refactor function to relativize paths in utils
pulkit created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Commands like `files`, `status` supports printing relative paths. Hence we need to re-use this code in other places too. So let's take this out from `rhg files` into a utility function. Next patch will make `rhg status` use it. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11613 AFFECTED FILES rust/rhg/src/commands/files.rs rust/rhg/src/main.rs rust/rhg/src/utils/path_utils.rs CHANGE DETAILS diff --git a/rust/rhg/src/utils/path_utils.rs b/rust/rhg/src/utils/path_utils.rs new file mode 100644 --- /dev/null +++ b/rust/rhg/src/utils/path_utils.rs @@ -0,0 +1,48 @@ +// path utils module +// +// This software may be used and distributed according to the terms of the +// GNU General Public License version 2 or any later version. + +use crate::error::CommandError; +use crate::ui::UiError; +use hg::repo::Repo; +use hg::utils::current_dir; +use hg::utils::files::{get_bytes_from_path, relativize_path}; +use hg::utils::hg_path::HgPath; +use hg::utils::hg_path::HgPathBuf; +use std::borrow::Cow; + +pub fn relativize_paths( +repo: , +paths: impl IntoIterator>, +mut callback: impl FnMut(Cow<[u8]>) -> Result<(), UiError>, +) -> Result<(), CommandError> { +let cwd = current_dir()?; +let repo_root = repo.working_directory_path(); +let repo_root = cwd.join(repo_root); // Make it absolute +let repo_root_hgpath = +HgPathBuf::from(get_bytes_from_path(repo_root.to_owned())); +let outside_repo: bool; +let cwd_hgpath: HgPathBuf; + +if let Ok(cwd_relative_to_repo) = cwd.strip_prefix(_root) { +// The current directory is inside the repo, so we can work with +// relative paths +outside_repo = false; +cwd_hgpath = +HgPathBuf::from(get_bytes_from_path(cwd_relative_to_repo)); +} else { +outside_repo = true; +cwd_hgpath = HgPathBuf::from(get_bytes_from_path(cwd)); +} + +for file in paths { +if outside_repo { +let file = repo_root_hgpath.join(file.as_ref()); +callback(relativize_path(, _hgpath))?; +} else { +callback(relativize_path(file.as_ref(), _hgpath))?; +} +} +Ok(()) +} diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs --- a/rust/rhg/src/main.rs +++ b/rust/rhg/src/main.rs @@ -17,6 +17,9 @@ mod blackbox; mod error; mod ui; +pub mod utils { +pub mod path_utils; +} use error::CommandError; fn main_with_result( diff --git a/rust/rhg/src/commands/files.rs b/rust/rhg/src/commands/files.rs --- a/rust/rhg/src/commands/files.rs +++ b/rust/rhg/src/commands/files.rs @@ -1,12 +1,13 @@ use crate::error::CommandError; use crate::ui::Ui; +use crate::ui::UiError; +use crate::utils::path_utils::relativize_paths; use clap::Arg; use hg::operations::list_rev_tracked_files; use hg::operations::Dirstate; use hg::repo::Repo; -use hg::utils::current_dir; -use hg::utils::files::{get_bytes_from_path, relativize_path}; -use hg::utils::hg_path::{HgPath, HgPathBuf}; +use hg::utils::hg_path::HgPath; +use std::borrow::Cow; pub const HELP_TEXT: = " List tracked files. @@ -54,34 +55,13 @@ files: impl IntoIterator, ) -> Result<(), CommandError> { let mut stdout = ui.stdout_buffer(); - -let cwd = current_dir()?; -let working_directory = repo.working_directory_path(); -let working_directory = cwd.join(working_directory); // Make it absolute +let mut any = false; -let mut any = false; -if let Ok(cwd_relative_to_repo) = cwd.strip_prefix(_directory) { -// The current directory is inside the repo, so we can work with -// relative paths -let cwd = HgPathBuf::from(get_bytes_from_path(cwd_relative_to_repo)); -for file in files { -any = true; -stdout.write_all(relativize_path(, ).as_ref())?; -stdout.write_all(b"\n")?; -} -} else { -let working_directory = -HgPathBuf::from(get_bytes_from_path(working_directory)); -let cwd = HgPathBuf::from(get_bytes_from_path(cwd)); -for file in files { -any = true; -// Absolute path in the filesystem -let file = working_directory.join(file); -stdout.write_all(relativize_path(, ).as_ref())?; -stdout.write_all(b"\n")?; -} -} - +relativize_paths(repo, files, |path: Cow<[u8]>| -> Result<(), UiError> { +any = true; +stdout.write_all(path.as_ref())?; +stdout.write_all(b"\n") +})?; stdout.flush()?; if any { Ok(()) To: pulkit, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D11614: rhg: add relative paths support in `rhg status`
pulkit created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11614 AFFECTED FILES rust/rhg/src/commands/status.rs CHANGE DETAILS diff --git a/rust/rhg/src/commands/status.rs b/rust/rhg/src/commands/status.rs --- a/rust/rhg/src/commands/status.rs +++ b/rust/rhg/src/commands/status.rs @@ -6,9 +6,11 @@ // GNU General Public License version 2 or any later version. use crate::error::CommandError; -use crate::ui::Ui; +use crate::ui::{Ui, UiError}; +use crate::utils::path_utils::relativize_paths; use clap::{Arg, SubCommand}; use hg; +use hg::config::Config; use hg::errors::HgError; use hg::manifest::Manifest; use hg::matchers::AlwaysMatcher; @@ -16,6 +18,7 @@ use hg::utils::hg_path::{hg_path_to_os_string, HgPath}; use hg::{HgPathCow, StatusOptions}; use log::{info, warn}; +use std::borrow::Cow; pub const HELP_TEXT: = " Show changed files in the working directory @@ -146,6 +149,7 @@ } let ui = invocation.ui; +let config = invocation.config; let args = invocation.subcommand_args; let display_states = if args.is_present("all") { // TODO when implementing `--quiet`: it excludes clean files @@ -225,25 +229,25 @@ } } if display_states.modified { -display_status_paths(ui, ds_status.modified, b"M")?; +display_status_paths(ui, repo, config, ds_status.modified, b"M")?; } if display_states.added { -display_status_paths(ui, ds_status.added, b"A")?; +display_status_paths(ui, repo, config, ds_status.added, b"A")?; } if display_states.removed { -display_status_paths(ui, ds_status.removed, b"R")?; +display_status_paths(ui, repo, config, ds_status.removed, b"R")?; } if display_states.deleted { -display_status_paths(ui, ds_status.deleted, b"!")?; +display_status_paths(ui, repo, config, ds_status.deleted, b"!")?; } if display_states.unknown { -display_status_paths(ui, ds_status.unknown, b"?")?; +display_status_paths(ui, repo, config, ds_status.unknown, b"?")?; } if display_states.ignored { -display_status_paths(ui, ds_status.ignored, b"I")?; +display_status_paths(ui, repo, config, ds_status.ignored, b"I")?; } if display_states.clean { -display_status_paths(ui, ds_status.clean, b"C")?; +display_status_paths(ui, repo, config, ds_status.clean, b"C")?; } Ok(()) } @@ -252,16 +256,35 @@ // harcode HgPathBuf, but probably not really useful at this point fn display_status_paths( ui: , +repo: , +config: , paths: [HgPathCow], status_prefix: &[u8], ) -> Result<(), CommandError> { paths.sort_unstable(); -for path in paths { -// Same TODO as in commands::root -let bytes: &[u8] = path.as_bytes(); -// TODO optim, probably lots of unneeded copies here, especially -// if out stream is buffered -ui.write_stdout(&[status_prefix, b" ", bytes, b"\n"].concat())?; +let mut relative: bool = +config.get_bool(b"ui", b"relative-paths").unwrap_or(false); +relative = config +.get_bool(b"commands", b"status.relative") +.unwrap_or(relative); +if relative { +relativize_paths( +repo, +paths, +|path: Cow<[u8]>| -> Result<(), UiError> { +ui.write_stdout( +&[status_prefix, b" ", path.as_ref(), b"\n"].concat(), +) +}, +)?; +} else { +for path in paths { +// Same TODO as in commands::root +let bytes: &[u8] = path.as_bytes(); +// TODO optim, probably lots of unneeded copies here, especially +// if out stream is buffered +ui.write_stdout(&[status_prefix, b" ", bytes, b"\n"].concat())?; +} } Ok(()) } To: pulkit, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D11610: largefiles: pass current transaction to `lfdirstate.write()`
pulkit created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Right now, the largefile dirstate is not included in transaction which makes things complex. Next patch will add code to do so, so let's make it mandatory to pass current transaction and pass from all existing callers. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11610 AFFECTED FILES hgext/largefiles/lfcommands.py hgext/largefiles/lfutil.py hgext/largefiles/overrides.py hgext/largefiles/reposetup.py CHANGE DETAILS diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py --- a/hgext/largefiles/reposetup.py +++ b/hgext/largefiles/reposetup.py @@ -310,7 +310,7 @@ ] if gotlock: -lfdirstate.write() +lfdirstate.write(self.currenttransaction()) self.lfstatus = True return scmutil.status(*result) diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -151,7 +151,7 @@ ) standins.append(standinname) lfdirstate.set_tracked(f) -lfdirstate.write() +lfdirstate.write(repo.currenttransaction()) bad += [ lfutil.splitstandin(f) for f in repo[None].add(standins) @@ -229,7 +229,7 @@ for f in remove: lfdirstate.set_untracked(lfutil.splitstandin(f)) -lfdirstate.write() +lfdirstate.write(repo.currenttransaction()) return result @@ -659,7 +659,7 @@ ) # make sure lfile doesn't get synclfdirstate'd as normal lfdirstate.update_file(lfile, p1_tracked=False, wc_tracked=True) -lfdirstate.write() +lfdirstate.write(repo.currenttransaction()) return orig(repo, actions, branchmerge, getfiledata) @@ -864,7 +864,7 @@ util.copyfile(repo.wjoin(srclfile), repo.wjoin(destlfile)) lfdirstate.set_tracked(destlfile) -lfdirstate.write() +lfdirstate.write(repo.currenttransaction()) except error.Abort as e: if e.message != _(b'no files to copy'): raise e @@ -896,7 +896,7 @@ with repo.wlock(): lfdirstate = lfutil.openlfdirstate(ui, repo) s = lfutil.lfdirstatestatus(lfdirstate, repo) -lfdirstate.write() +lfdirstate.write(repo.currenttransaction()) for lfile in s.modified: lfutil.updatestandin(repo, lfile, lfutil.standin(lfile)) for lfile in s.deleted: @@ -1383,7 +1383,7 @@ lfdirstate = lfutil.openlfdirstate(ui, repo) for f in forget: lfdirstate.set_untracked(f) -lfdirstate.write() +lfdirstate.write(repo.currenttransaction()) standins = [lfutil.standin(f) for f in forget] for f in standins: repo.wvfs.unlinkpath(f, ignoremissing=True) @@ -1792,7 +1792,7 @@ # interrupted before largefiles and lfdirstate are synchronized for lfile in oldclean: lfdirstate.set_possibly_dirty(lfile) -lfdirstate.write() +lfdirstate.write(repo.currenttransaction()) oldstandins = lfutil.getstandinsstate(repo) wc = kwargs.get('wc') @@ -1812,7 +1812,7 @@ # all the ones that didn't change as clean for lfile in oldclean.difference(filelist): lfdirstate.update_file(lfile, p1_tracked=True, wc_tracked=True) -lfdirstate.write() +lfdirstate.write(repo.currenttransaction()) if branchmerge or force or partial: filelist.extend(s.deleted + s.removed) diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -191,7 +191,7 @@ def _ignore(self, f): return False -def write(self, tr=False): +def write(self, tr): # (1) disable PENDING mode always # (lfdirstate isn't yet managed as a part of the transaction) # (2) avoid develwarn 'use dirstate.write with ' @@ -588,7 +588,7 @@ lfile = splitstandin(f) if lfile is not None: synclfdirstate(repo, lfdirstate, lfile, False) -lfdirstate.write() +lfdirstate.write(repo.currenttransaction()) # As part of committing, copy all of the largefiles into the cache. # diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py --- a/hgext/largefiles/lfcommands.py +++ b/hgext/largefiles/lfcommands.py @@ -569,7 +569,7 @@ removed += 1 # largefile processing might be slow and be interrupted - be prepared -lfdirstate.write() +
D11612: largefiles: partially undo 61e526585b20e2ff15f19497d0451d18fea02db8 and child
pulkit created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Since the largefiles dirstate is now part of transaction, we get rid of this temporary fix which lived for ~7 years. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11612 AFFECTED FILES hgext/largefiles/overrides.py CHANGE DETAILS diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1636,18 +1636,6 @@ for standin in orphans: repo.wvfs.unlinkpath(standin, ignoremissing=True) -lfdirstate = lfutil.openlfdirstate(ui, repo) -with lfdirstate.parentchange(): -orphans = set(lfdirstate) -lfiles = lfutil.listlfiles(repo) -for file in lfiles: -lfutil.synclfdirstate(repo, lfdirstate, file, True) -orphans.discard(file) -for lfile in orphans: -lfdirstate.update_file( -lfile, p1_tracked=False, wc_tracked=False -) -lfdirstate.write() return result To: pulkit, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D11611: largefiles: add tr backup for largefilesdirstate
pulkit created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This will help us in automatically restoring the largefilesdirstate if a transaction is rolled back. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11611 AFFECTED FILES hgext/largefiles/lfutil.py tests/test-largefiles-cache.t CHANGE DETAILS diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t --- a/tests/test-largefiles-cache.t +++ b/tests/test-largefiles-cache.t @@ -185,10 +185,12 @@ $ find share_dst/.hg/largefiles/* | sort share_dst/.hg/largefiles/dirstate + share_dst/.hg/largefiles/undo.backup.dirstate $ find src/.hg/largefiles/* | egrep "(dirstate|$hash)" | sort src/.hg/largefiles/dirstate src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 + src/.hg/largefiles/undo.backup.dirstate Verify that backwards compatibility is maintained for old storage layout $ mv src/.hg/largefiles/$hash share_dst/.hg/largefiles diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -195,6 +195,8 @@ # (1) disable PENDING mode always # (lfdirstate isn't yet managed as a part of the transaction) # (2) avoid develwarn 'use dirstate.write with ' +if tr: +tr.addbackup(b'largefiles/dirstate', location=b'plain') super(largefilesdirstate, self).write(None) To: pulkit, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel