<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-size:12.8px">Not super enthousiastic about this behavior. Could we just not update anywhere in that situation? Without the abort, possibly with a message mentionning thate uncommited branch foo does not exist yet, so we are not updating anywhere.</span></blockquote><div><br></div><div>This behaviour would be perfectly reasonable too<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-size:12.8px">Why do we need this? if clean, won't wc.branch() return the same thing as repo["."] branch?</span></blockquote><div><br></div><div>If branch is newly created wc.branch() is different than its first parent (repo["."]), if branch is the same for working directory as its first parent then it preserves old behaviour. </div><div><br></div><div>Clean option doesn't tell if working directory has the same branch as first parent or not, or i just don't understand sth.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-size:12.8px">Here, we could check if the branch exist in the repository at all and issue a special message if not.</span></blockquote><div><br></div><div> Ok, i will change this behaviour in next patch</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-02-24 23:54 GMT+01:00 Pierre-Yves David <span dir="ltr"><<a href="mailto:pierre-yves.david@ens-lyon.org" target="_blank">pierre-yves.david@ens-lyon.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 02/23/2016 07:40 PM, liscju wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
# HG changeset patch<br>
# User liscju <<a href="mailto:piotr.listkiewicz@gmail.com" target="_blank">piotr.listkiewicz@gmail.com</a>><br>
# Date 1456249877 -3600<br>
#      Tue Feb 23 18:51:17 2016 +0100<br>
# Node ID 541ba7dc5f2667298c3ff2d72e5c05559a79ba92<br>
# Parent  91a827e760df9d9b3d86692c5aa195a3d6ba2208<br>
mercurial: fixes update --clean to work on new branch (issue5003)<br>
<br>
So far 'hg update --clean' on newly created branch results in abort<br>
with branch not found error. Before this patch the destination node<br>
was resolved using instruction:<br>
<br>
node = repo.revs('max(.::(head() and branch(%s)))'<br>
                          , wc.branch()).first()<br>
<br>
Problem occures when wc.branch() is newly created branch in<br>
working directory, so there are no changeset having branch<br>
the same as branch in working copy.<br>
<br>
This patch fixes this problem by searching for revision having<br>
the same branch as first parent of working directory.<br>
</blockquote>
<br></span>
Not super enthousiastic about this behavior. Could we just not update anywhere in that situation? Without the abort, possibly with a message mentionning thate uncommited branch foo does not exist yet, so we are not updating anywhere.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff -r 91a827e760df -r 541ba7dc5f26 mercurial/destutil.py<br>
--- a/mercurial/destutil.py     Sun Feb 14 01:33:55 2016 +0900<br>
+++ b/mercurial/destutil.py     Tue Feb 23 18:51:17 2016 +0100<br>
@@ -91,13 +91,17 @@ def _destupdatebranch(repo, clean, check<br>
      """decide on an update destination from current branch"""<br>
      wc = repo[None]<br>
      movemark = node = None<br>
+    if clean:<br>
+        branch = repo["."].branch()<br>
+    else:<br>
+        branch = wc.branch()<br>
</blockquote>
<br></span>
Why do we need this? if clean, won't wc.branch() return the same thing as repo["."] branch?<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
      try:<br>
          node = repo.revs('max(.::(head() and branch(%s)))'<br>
-                         , wc.branch()).first()<br>
+                         , branch).first()<br>
          if bookmarks.isactivewdirparent(repo):<br>
              movemark = repo['.'].node()<br>
      except error.RepoLookupError:<br>
-        if wc.branch() == 'default': # no default branch!<br>
+        if branch == 'default': # no default branch!<br>
              node = repo.lookup('tip') # update to tip<br>
          else:<br>
              raise error.Abort(_("branch %s not found") % wc.branch())<br>
</blockquote>
<br></span>
Here, we could check if the branch exist in the repository at all and issue a special message if not.<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Pierre-Yves David<br>
</font></span></blockquote></div><br></div>