From patchwork Mon May 19 20:33:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5, of, 5] convert: introduce --config convert.hg.full=1 for adding all files, not just changed From: Mads Kiilerich X-Patchwork-Id: 4819 Message-Id: To: mercurial-devel@selenic.com Date: Mon, 19 May 2014 22:33:33 +0200 # HG changeset patch # User Mads Kiilerich # Date 1400530735 -7200 # Mon May 19 22:18:55 2014 +0200 # Node ID fbd0070089aef388ffb4bbae6ac34ff2bc17cd3f # Parent c28cc8a6bd6226f0588365d5ae8e3d8a42cfa063 convert: introduce --config convert.hg.full=1 for adding all files, not just changed _Should_ in most cases not make any difference but will make convert significantly slower. Can be used when using filemap to add files that haven't been modified but are made visible by removing and exclude or adding and include. Note: This feature do not (yet) remove files that are excluded or no longer are included. diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -270,6 +270,7 @@ class mercurial_source(converter_source) self.ignoreerrors = ui.configbool('convert', 'hg.ignoreerrors', False) self.ignored = set() self.saverev = ui.configbool('convert', 'hg.saverev', False) + self.full = ui.configbool('convert', 'hg.full', False) try: self.repo = hg.repository(self.ui, path) # try to provoke an exception if this isn't really a hg @@ -346,14 +347,17 @@ class mercurial_source(converter_source) # self.ignored self.getcopies(ctx, parents, files) return [(f, rev) for f in files if f not in self.ignored], {} - if self._changescache and self._changescache[0] == rev: + if (self._changescache and self._changescache[0] == rev and + not self.full): m, a, r = self._changescache[1] + d = u = i = c = [] else: - m, a, r = self.repo.status(parents[0].node(), ctx.node())[:3] + m, a, r, d, u, i, c = self.repo.status(parents[0].node(), + ctx.node(), clean=self.full) # getcopies() detects missing revlogs early, run it before # filtering the changes. copies = self.getcopies(ctx, parents, m + a) - changes = [(name, rev) for name in m + a + r + changes = [(name, rev) for name in m + a + r + c if name not in self.ignored] return sorted(changes), copies diff --git a/tests/test-convert-hg-sink.t b/tests/test-convert-hg-sink.t --- a/tests/test-convert-hg-sink.t +++ b/tests/test-convert-hg-sink.t @@ -515,11 +515,16 @@ An additional round, demonstrating that o 0 0 (a-only f) -Conversion after rollback +Conversion after rollback and full conversion restoring unmasked but unmodified files $ hg -R a rollback -f repository tip rolled back to revision 2 (undo commit) + $ cat >> $HGRCPATH < [convert] + > hg.full=True + > EOF + $ hg convert --filemap filemap-b 0 a --config convert.hg.revs=1:: scanning source... sorting... @@ -527,7 +532,7 @@ Conversion after rollback 0 extra f+a-only change $ hg -R a log -G -T '{rev} {desc|firstline} ({files})\n' - o 3 extra f+a-only change (f) + o 3 extra f+a-only change (b-only f) | o 2 x (f) |