From 06fba299008b40d11023dc03163e497c66fea4a0 Mon Sep 17 00:00:00 2001 From: APPLE Date: Fri, 6 Mar 2026 13:26:20 +0530 Subject: [PATCH] Fix bzr file renames not being tracked When Bazaar logs a file rename (bzr mv Foo Bar), the verbose log outputs "R old_path => new_path". Previously this was passed through as a single modify action on a nonsensical filename. Split rename entries into a delete of the old path and an add of the new path, matching how other VCS parsers handle renames. Fixes #38 Co-Authored-By: Claude Opus 4.6 --- src/formats/bzr.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/formats/bzr.cpp b/src/formats/bzr.cpp index 81fbc122..07c3cc0b 100644 --- a/src/formats/bzr.cpp +++ b/src/formats/bzr.cpp @@ -118,7 +118,24 @@ bool BazaarLog::parseCommit(RCommit& commit) { while(logf->getNextLine(line) && line.size()) { if (!bzr_file_regex.match(line, &entries)) continue; - commit.addFile(entries[1], entries[0]); + + std::string action = entries[0]; + std::string filename = entries[1]; + + if(action == "R") { + // Rename: "old_path => new_path" + size_t arrow = filename.find(" => "); + if(arrow != std::string::npos) { + std::string old_path = filename.substr(0, arrow); + std::string new_path = filename.substr(arrow + 4); + commit.addFile(old_path, "D"); + commit.addFile(new_path, "A"); + } else { + commit.addFile(filename, "A"); + } + } else { + commit.addFile(filename, action); + } } return true;