Patchwork [1,of,3] bundle2: use "else" instead of checking condition again

login
register
mail settings
Submitter via Mercurial-devel
Date June 16, 2017, 9:26 p.m.
Message ID <01e43f5ed3b796c8eeb6.1497648397@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/21435/
State Accepted
Headers show

Comments

via Mercurial-devel - June 16, 2017, 9:26 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1497634603 25200
#      Fri Jun 16 10:36:43 2017 -0700
# Node ID 01e43f5ed3b796c8eeb629efc0a2dc2cc2be23b4
# Parent  a3a36bcf122e2ea4edbbe4ac44da59446cf0ee07
bundle2: use "else" instead of checking condition again
Yuya Nishihara - June 17, 2017, 3:07 a.m.
On Fri, 16 Jun 2017 14:26:37 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1497634603 25200
> #      Fri Jun 16 10:36:43 2017 -0700
> # Node ID 01e43f5ed3b796c8eeb629efc0a2dc2cc2be23b4
> # Parent  a3a36bcf122e2ea4edbbe4ac44da59446cf0ee07
> bundle2: use "else" instead of checking condition again

Queued these, thanks.

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1200,7 +1200,7 @@ 
             with repo.transaction('histedit.abort') as tr:
                 if not isinstance(gen, bundle2.unbundle20):
                     gen.apply(repo, 'histedit', 'bundle:' + backupfile)
-                if isinstance(gen, bundle2.unbundle20):
+                else:
                     bundle2.applybundle(repo, gen, tr,
                                         source='histedit',
                                         url='bundle:' + backupfile)
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -130,7 +130,7 @@ 
                 gen.apply(self.repo, 'unshelve',
                           'bundle:' + self.vfs.join(self.fname),
                           targetphase=phases.secret)
-            if isinstance(gen, bundle2.unbundle20):
+            else:
                 bundle2.applybundle(self.repo, gen,
                                     self.repo.currenttransaction(),
                                     source='unshelve',