Show More
@@ -772,9 +772,11 b' def merging_from_remote(ui, repo, remote' | |||||
772 | return changed |
|
772 | return changed | |
773 |
|
773 | |||
774 |
|
774 | |||
775 | def updatefromremote(ui, repo, remotemarks, path, trfunc, explicit=()): |
|
775 | def updatefromremote( | |
|
776 | ui, repo, remotemarks, path, trfunc, explicit=(), mode=None | |||
|
777 | ): | |||
776 | ui.debug(b"checking for updated bookmarks\n") |
|
778 | ui.debug(b"checking for updated bookmarks\n") | |
777 | if ui.configbool(b'bookmarks', b'mirror'): |
|
779 | if mode == b'mirror': | |
778 | changed = mirroring_remote(ui, repo, remotemarks) |
|
780 | changed = mirroring_remote(ui, repo, remotemarks) | |
779 | else: |
|
781 | else: | |
780 | changed = merging_from_remote(ui, repo, remotemarks, path, explicit) |
|
782 | changed = merging_from_remote(ui, repo, remotemarks, path, explicit) |
@@ -207,11 +207,6 b' coreconfigitem(' | |||||
207 | b'pushing', |
|
207 | b'pushing', | |
208 | default=list, |
|
208 | default=list, | |
209 | ) |
|
209 | ) | |
210 | coreconfigitem( |
|
|||
211 | b'bookmarks', |
|
|||
212 | b'mirror', |
|
|||
213 | default=False, |
|
|||
214 | ) |
|
|||
215 | # bundle.mainreporoot: internal hack for bundlerepo |
|
210 | # bundle.mainreporoot: internal hack for bundlerepo | |
216 | coreconfigitem( |
|
211 | coreconfigitem( | |
217 | b'bundle', |
|
212 | b'bundle', |
@@ -2028,6 +2028,9 b' def _pullbookmarks(pullop):' | |||||
2028 | pullop.stepsdone.add(b'bookmarks') |
|
2028 | pullop.stepsdone.add(b'bookmarks') | |
2029 | repo = pullop.repo |
|
2029 | repo = pullop.repo | |
2030 | remotebookmarks = pullop.remotebookmarks |
|
2030 | remotebookmarks = pullop.remotebookmarks | |
|
2031 | bookmarks_mode = None | |||
|
2032 | if pullop.remote_path is not None: | |||
|
2033 | bookmarks_mode = pullop.remote_path.bookmarks_mode | |||
2031 | bookmod.updatefromremote( |
|
2034 | bookmod.updatefromremote( | |
2032 | repo.ui, |
|
2035 | repo.ui, | |
2033 | repo, |
|
2036 | repo, | |
@@ -2035,6 +2038,7 b' def _pullbookmarks(pullop):' | |||||
2035 | pullop.remote.url(), |
|
2038 | pullop.remote.url(), | |
2036 | pullop.gettransaction, |
|
2039 | pullop.gettransaction, | |
2037 | explicit=pullop.explicitbookmarks, |
|
2040 | explicit=pullop.explicitbookmarks, | |
|
2041 | mode=bookmarks_mode, | |||
2038 | ) |
|
2042 | ) | |
2039 |
|
2043 | |||
2040 |
|
2044 |
@@ -418,16 +418,6 b' Supported arguments:' | |||||
418 | If no suitable authentication entry is found, the user is prompted |
|
418 | If no suitable authentication entry is found, the user is prompted | |
419 | for credentials as usual if required by the remote. |
|
419 | for credentials as usual if required by the remote. | |
420 |
|
420 | |||
421 | ``bookmarks`` |
|
|||
422 | ------------- |
|
|||
423 |
|
||||
424 | Controls some aspect of bookmarks. |
|
|||
425 |
|
||||
426 | ``mirror`` |
|
|||
427 | When pulling, instead of merging local bookmarks and remote bookmarks, |
|
|||
428 | replace local bookmarks by remote bookmarks. This is useful to replicate |
|
|||
429 | a repository, or as an optimization. (default: False) |
|
|||
430 |
|
||||
431 | ``cmdserver`` |
|
421 | ``cmdserver`` | |
432 | ------------- |
|
422 | ------------- | |
433 |
|
423 | |||
@@ -1758,6 +1748,15 b' The following sub-options can be defined' | |||||
1758 | Revsets specifying bookmarks will not result in the bookmark being |
|
1748 | Revsets specifying bookmarks will not result in the bookmark being | |
1759 | pushed. |
|
1749 | pushed. | |
1760 |
|
1750 | |||
|
1751 | ``bookmarks.mode`` | |||
|
1752 | How bookmark will be dealt during the exchange. It support the following value | |||
|
1753 | ||||
|
1754 | - ``default``: the default behavior, local and remote bookmarks are "merged" | |||
|
1755 | on push/pull. | |||
|
1756 | ||||
|
1757 | - ``mirror``: when pulling, replace local bookmarks by remote bookmarks. This | |||
|
1758 | is useful to replicate a repository, or as an optimization. | |||
|
1759 | ||||
1761 | The following special named paths exist: |
|
1760 | The following special named paths exist: | |
1762 |
|
1761 | |||
1763 | ``default`` |
|
1762 | ``default`` |
@@ -766,6 +766,27 b' def pushrevpathoption(ui, path, value):' | |||||
766 | return value |
|
766 | return value | |
767 |
|
767 | |||
768 |
|
768 | |||
|
769 | SUPPORTED_BOOKMARKS_MODES = { | |||
|
770 | b'default', | |||
|
771 | b'mirror', | |||
|
772 | } | |||
|
773 | ||||
|
774 | ||||
|
775 | @pathsuboption(b'bookmarks.mode', b'bookmarks_mode') | |||
|
776 | def bookmarks_mode_option(ui, path, value): | |||
|
777 | if value not in SUPPORTED_BOOKMARKS_MODES: | |||
|
778 | path_name = path.name | |||
|
779 | if path_name is None: | |||
|
780 | # this is an "anonymous" path, config comes from the global one | |||
|
781 | path_name = b'*' | |||
|
782 | msg = _(b'(paths.%s:bookmarks.mode has unknown value: "%s")\n') | |||
|
783 | msg %= (path_name, value) | |||
|
784 | ui.warn(msg) | |||
|
785 | if value == b'default': | |||
|
786 | value = None | |||
|
787 | return value | |||
|
788 | ||||
|
789 | ||||
769 | @pathsuboption(b'multi-urls', b'multi_urls') |
|
790 | @pathsuboption(b'multi-urls', b'multi_urls') | |
770 | def multiurls_pathoption(ui, path, value): |
|
791 | def multiurls_pathoption(ui, path, value): | |
771 | res = stringutil.parsebool(value) |
|
792 | res = stringutil.parsebool(value) |
@@ -1,6 +1,10 b'' | |||||
1 | == New Features == |
|
1 | == New Features == | |
2 | * `debugrebuildfncache` now has an option to rebuild only the index files |
|
2 | * `debugrebuildfncache` now has an option to rebuild only the index files | |
3 |
|
3 | |||
|
4 | * a new `bookmarks.mode` path option have been introduced to control the | |||
|
5 | bookmark update strategy during exchange with a peer. See hg help paths for | |||
|
6 | details. | |||
|
7 | ||||
4 |
|
8 | |||
5 | == Default Format Change == |
|
9 | == Default Format Change == | |
6 |
|
10 |
@@ -503,7 +503,7 b' mirroring bookmarks' | |||||
503 | * foobar 1:9b140be10808 |
|
503 | * foobar 1:9b140be10808 | |
504 | $ cp .hg/bookmarks .hg/bookmarks.bak |
|
504 | $ cp .hg/bookmarks .hg/bookmarks.bak | |
505 | $ hg book -d X |
|
505 | $ hg book -d X | |
506 |
$ hg pull ../a --config bookmarks.m |
|
506 | $ hg pull ../a --config 'paths.*:bookmarks.mode=mirror' | |
507 | pulling from ../a |
|
507 | pulling from ../a | |
508 | searching for changes |
|
508 | searching for changes | |
509 | no changes found |
|
509 | no changes found |
@@ -1900,6 +1900,15 b' Test section lookup' | |||||
1900 | Revsets specifying bookmarks will not result in the bookmark being |
|
1900 | Revsets specifying bookmarks will not result in the bookmark being | |
1901 | pushed. |
|
1901 | pushed. | |
1902 |
|
1902 | |||
|
1903 | "bookmarks.mode" | |||
|
1904 | How bookmark will be dealt during the exchange. It support the following | |||
|
1905 | value | |||
|
1906 | ||||
|
1907 | - "default": the default behavior, local and remote bookmarks are | |||
|
1908 | "merged" on push/pull. | |||
|
1909 | - "mirror": when pulling, replace local bookmarks by remote bookmarks. | |||
|
1910 | This is useful to replicate a repository, or as an optimization. | |||
|
1911 | ||||
1903 | The following special named paths exist: |
|
1912 | The following special named paths exist: | |
1904 |
|
1913 | |||
1905 | "default" |
|
1914 | "default" |
General Comments 0
You need to be logged in to leave comments.
Login now