[PATCH 4 of 6] localrepo: have stream_in() not modify its argument

Drew Gottlieb drgott at google.com
Fri May 1 18:19:10 CDT 2015


# HG changeset patch
# User Drew Gottlieb <drgott at google.com>
# Date 1429732752 25200
#      Wed Apr 22 12:59:12 2015 -0700
# Node ID 74730f9658d383f45cc5fb2089530df4c981f03e
# Parent  9bc80406fce09833ff5a3ab1845337efb2ad30b6
localrepo: have stream_in() not modify its argument

Localrepo's stream_in function modified its requirements argument. This is not
good practice because it may be unexpected behavior to the caller.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1827,8 +1827,8 @@
             # new requirements = old non-format requirements +
             #                    new format-related
             # requirements from the streamed-in repository
-            requirements.update(self.requirements - self.supportedformats)
-            self.requirements = requirements
+            self.requirements = requirements | (
+                    self.requirements - self.supportedformats)
             self._applyopenerreqs()
             self._writerequirements()
 


More information about the Mercurial-devel mailing list