Patchwork [3,of,4] record: remove dependency on hg module in record

login
register
mail settings
Submitter Laurent Charignon
Date March 11, 2015, 2:24 a.m.
Message ID <2b92363b2413d2ed90c7.1426040670@dev919.prn2.facebook.com>
Download mbox | patch
Permalink /patch/7991/
State Accepted
Headers show

Comments

Laurent Charignon - March 11, 2015, 2:24 a.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1426032547 25200
#      Tue Mar 10 17:09:07 2015 -0700
# Node ID 2b92363b2413d2ed90c7b8a8575e6545f5e8e0e9
# Parent  e1001632d4a719089d475692c64a47ad516de115
record: remove dependency on hg module in record

Part of a serie of patches to move record from hgext to core

Patch

diff --git a/hgext/record.py b/hgext/record.py
--- a/hgext/record.py
+++ b/hgext/record.py
@@ -8,8 +8,9 @@ 
 '''commands to interactively select changes for commit/qrefresh'''
 
 from mercurial.i18n import _
-from mercurial import cmdutil, commands, extensions, hg, patch
+from mercurial import cmdutil, commands, extensions, patch
 from mercurial import util
+from mercurial import merge as mergemod
 import cStringIO, errno, os, shutil, tempfile
 
 cmdtable = {}
@@ -205,8 +206,10 @@ 
 
             # 3a. apply filtered patch to clean repo  (clean)
             if backups:
-                hg.revert(repo, repo.dirstate.p1(),
-                          lambda key: key in backups)
+                # Equivalent to hg.revert
+                choices = lambda key: key in backups
+                mergemod.update(repo, repo.dirstate.p1(),
+                        False, True, choices)
 
             # 3b. (apply)
             if dopatch: