[PATCH 2 of 2] pull: abort pull --update if config requires destination (issue5528)

Ryan McElroy rm at fb.com
Fri Apr 7 13:32:23 UTC 2017


# HG changeset patch
# User Ryan McElroy <rmcelroy at fb.com>
# Date 1491571910 25200
#      Fri Apr 07 06:31:50 2017 -0700
# Node ID 1a7c8af860b2bec0349661a82d2f449c9d2944bb
# Parent  3d5f4ddecd504abf742f89c7c5d27064e301bda8
pull: abort pull --update if config requires destination (issue5528)

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3935,6 +3935,12 @@ def pull(ui, repo, source="default", **o
 
     Returns 0 on success, 1 if an update had unresolved files.
     """
+
+    if ui.configbool('commands', 'update.requiredest') and opts.get('update'):
+        msg = _('update destination required by configuration')
+        hint = _('use hg pull followed by hg update DEST')
+        raise error.Abort(msg, hint=hint)
+
     source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
     ui.status(_('pulling from %s\n') % util.hidepassword(source))
     other = hg.peer(repo, opts, source)
diff --git a/tests/test-update-dest.t b/tests/test-update-dest.t
--- a/tests/test-update-dest.t
+++ b/tests/test-update-dest.t
@@ -21,3 +21,15 @@ Test update.requiredest
 
   $ cd ..
 
+Check update.requiredest interaction with pull --update
+  $ hg clone repo clone
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd repo
+  $ echo a >> a
+  $ hg commit -qAm aa
+  $ cd ../clone
+  $ hg pull --update
+  abort: update destination required by configuration
+  (use hg pull followed by hg update DEST)
+  [255]



More information about the Mercurial-devel mailing list