MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / rollback

Method rollback

src/filesystem/transaction.ts:230–252  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

228 }
229
230 // Always persist the ops to our journal — undo works regardless of git status.
231 this.journal.persistOps(
232 this.id,
233 this.sessionId,
234 this.ops,
235 this.gitSha,
236 this.toolCallId,
237 summary,
238 gitStatus,
239 gitFailReason,
240 );
241 this.gitStatus = gitStatus;
242 this.gitFailReason = gitFailReason;
243 this.status = 'committed';
244 return this.gitSha;
245 }
246
247 /** Information about whether git tracked this transaction. Surface to user after commit. */
248 public gitStatus: 'committed' | 'skipped-not-a-repo' | 'skipped-gitignored' | 'failed' = 'skipped-not-a-repo';
249 public gitFailReason: string | null = null;
250
251 async rollback(): Promise<void> {
252 if (this.status === 'rolled-back') return;
253
254 for (const op of [...this.ops].reverse()) {
255 try {

Callers 1

runMethod · 0.80

Calls 3

writeFileAtomicFunction · 0.85
warnMethod · 0.80
markRolledBackMethod · 0.80

Tested by

no test coverage detected