[PATCH 1 of 2 V8] update: fix bare update to work on new branch (BC)
Piotr Listkiewicz
piotr.listkiewicz at gmail.com
Wed Apr 13 07:30:48 EDT 2016
>
> Nearly there! Nitpick: "This commit" should be unnecessary - unless you
> specify otherwise, it's implied that the changes you discuss in the commit
> message are the changes made in this commit.
> Thus, you can reword this as "... new-branch not found'. Fix this by
> updating to the parent of wctx."
> Also, "paren't" looks like a typo.
You are right, changed it in V9
2016-04-13 12:28 GMT+02:00 Simon Farnsworth <simonfar at fb.com>:
> On 13/04/2016 09:48, liscju wrote:
>
>> # HG changeset patch
>> # User liscju <piotr.listkiewicz at gmail.com>
>> # Date 1459832013 -7200
>> # Tue Apr 05 06:53:33 2016 +0200
>> # Node ID cabc4e5224db4d4f02e4460f4349df2e7ffd2e52
>> # Parent 02be5fc18c0c70c087a9d1ab5ffe5afce926f227
>> update: fix bare update to work on new branch (BC)
>>
>> So far bare update on new branch results in
>> 'abort: branch new-branch not found'. This commit fixes
>> this by updating to the parent of wctx.
>>
>> The effect of updating to the parent of wctx is to move to the paren't
>> branch - this means that it is no longer necessary to prevent you from
>> updating if you would lose your newly created branch.
>>
>>
> Nearly there! Nitpick: "This commit" should be unnecessary - unless you
> specify otherwise, it's implied that the changes you discuss in the commit
> message are the changes made in this commit.
>
> Thus, you can reword this as "... new-branch not found'. Fix this by
> updating to the parent of wctx."
>
> Also, "paren't" looks like a typo.
>
> diff -r 02be5fc18c0c -r cabc4e5224db mercurial/destutil.py
>> --- a/mercurial/destutil.py Wed Mar 09 10:47:33 2016 -0500
>> +++ b/mercurial/destutil.py Tue Apr 05 06:53:33 2016 +0200
>> @@ -102,11 +102,7 @@ def _destupdatebranch(repo, clean, check
>> if bookmarks.isactivewdirparent(repo):
>> movemark = repo['.'].node()
>> else:
>> - if currentbranch == 'default': # no default branch!
>> - # update to the tipmost non-closed branch head
>> - node = repo.revs('max(head() and not closed())').first()
>> - else:
>> - raise error.Abort(_("branch %s not found") % currentbranch)
>> + node = repo['.'].node()
>> return node, movemark, None
>>
>> def _destupdatebranchfallback(repo, clean, check):
>> diff -r 02be5fc18c0c -r cabc4e5224db tests/test-newbranch.t
>> --- a/tests/test-newbranch.t Wed Mar 09 10:47:33 2016 -0500
>> +++ b/tests/test-newbranch.t Tue Apr 05 06:53:33 2016 +0200
>> @@ -211,8 +211,7 @@ Update with no arguments: tipmost revisi
>> marked working directory as branch foobar
>>
>> $ hg up
>> - abort: branch foobar not found
>> - [255]
>> + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
>>
>> Fast-forward merge:
>>
>> @@ -345,3 +344,50 @@ 2 branch heads, implicit merge works:
>> (branch merge, don't forget to commit)
>>
>> $ cd ..
>> +
>> +We expect that bare update on new branch, updates to parent
>> +
>> + $ hg init bareupdateonnewbranch
>> + $ cd bareupdateonnewbranch
>> + $ hg update
>> + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
>> + $ touch a
>> + $ hg commit -A -m "a"
>> + adding a
>> + $ touch b
>> + $ hg commit -A -m "b"
>> + adding b
>> + $ touch c
>> + $ hg commit -A -m "c"
>> + adding c
>> + $ hg update -r 1
>> + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>> + $ hg log -G
>> + o changeset: 2:991a3460af53
>> + | tag: tip
>> + | user: test
>> + | date: Thu Jan 01 00:00:00 1970 +0000
>> + | summary: c
>> + |
>> + @ changeset: 1:0e067c57feba
>> + | user: test
>> + | date: Thu Jan 01 00:00:00 1970 +0000
>> + | summary: b
>> + |
>> + o changeset: 0:3903775176ed
>> + user: test
>> + date: Thu Jan 01 00:00:00 1970 +0000
>> + summary: a
>> +
>> + $ hg branch dev
>> + marked working directory as branch dev
>> + (branches are permanent and global, did you want a bookmark?)
>> + $ hg update
>> + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
>> + $ hg summary
>> + parent: 1:0e067c57feba
>> + b
>> + branch: dev
>> + commit: (new branch)
>> + update: (current)
>> + phases: 3 draft
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at mercurial-scm.org
>>
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_mailman_listinfo_mercurial-2Ddevel&d=CwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=mEgSWILcY4c4W3zjApBQLA&m=94wDFOL_oBC1eZX0h_kzxGggof_V8t4j8dWo1VPU_Jc&s=d4pyq5zvz_oRSVMgC1i22yWGxBovGMYJfRlJ0_iglJo&e=
>>
>>
> --
> Simon Farnsworth
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160413/677a9cea/attachment.html>
More information about the Mercurial-devel
mailing list