##// END OF EJS Templates
export: add -B option to select a bookmark...
David Demelier -
r38035:c76526d7 default
parent child Browse files
Show More
@@ -50,6 +50,7 b' from . import ('
50 pycompat,
50 pycompat,
51 rcutil,
51 rcutil,
52 registrar,
52 registrar,
53 repair,
53 revsetlang,
54 revsetlang,
54 rewriteutil,
55 rewriteutil,
55 scmutil,
56 scmutil,
@@ -1895,7 +1896,9 b' def diff(ui, repo, *pats, **opts):'
1895 root=opts.get('root'))
1896 root=opts.get('root'))
1896
1897
1897 @command('^export',
1898 @command('^export',
1898 [('o', 'output', '',
1899 [('B', 'bookmark', '',
1900 _('export changes only reachable by given bookmark')),
1901 ('o', 'output', '',
1899 _('print output to file with formatted name'), _('FORMAT')),
1902 _('print output to file with formatted name'), _('FORMAT')),
1900 ('', 'switch-parent', None, _('diff against the second parent')),
1903 ('', 'switch-parent', None, _('diff against the second parent')),
1901 ('r', 'rev', [], _('revisions to export'), _('REV')),
1904 ('r', 'rev', [], _('revisions to export'), _('REV')),
@@ -1938,6 +1941,9 b' def export(ui, repo, *changesets, **opts'
1938 of files it detects as binary. With -a, export will generate a
1941 of files it detects as binary. With -a, export will generate a
1939 diff anyway, probably with undesirable results.
1942 diff anyway, probably with undesirable results.
1940
1943
1944 With -B/--bookmark changesets reachable by the given bookmark are
1945 selected.
1946
1941 Use the -g/--git option to generate diffs in the git extended diff
1947 Use the -g/--git option to generate diffs in the git extended diff
1942 format. See :hg:`help diffs` for more information.
1948 format. See :hg:`help diffs` for more information.
1943
1949
@@ -1966,11 +1972,24 b' def export(ui, repo, *changesets, **opts'
1966 Returns 0 on success.
1972 Returns 0 on success.
1967 """
1973 """
1968 opts = pycompat.byteskwargs(opts)
1974 opts = pycompat.byteskwargs(opts)
1975 bookmark = opts.get('bookmark')
1969 changesets += tuple(opts.get('rev', []))
1976 changesets += tuple(opts.get('rev', []))
1970 if not changesets:
1977
1971 changesets = ['.']
1978 if bookmark and changesets:
1972 repo = scmutil.unhidehashlikerevs(repo, changesets, 'nowarn')
1979 raise error.Abort(_("-r and -B are mutually exclusive"))
1973 revs = scmutil.revrange(repo, changesets)
1980
1981 if bookmark:
1982 if bookmark not in repo._bookmarks:
1983 raise error.Abort(_("bookmark '%s' not found") % bookmark)
1984
1985 revs = repair.stripbmrevset(repo, bookmark)
1986 else:
1987 if not changesets:
1988 changesets = ['.']
1989
1990 repo = scmutil.unhidehashlikerevs(repo, changesets, 'nowarn')
1991 revs = scmutil.revrange(repo, changesets)
1992
1974 if not revs:
1993 if not revs:
1975 raise error.Abort(_("export requires at least one changeset"))
1994 raise error.Abort(_("export requires at least one changeset"))
1976 if len(revs) > 1:
1995 if len(revs) > 1:
@@ -231,7 +231,7 b' Show all commands + options'
231 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
231 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
232 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
232 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
233 diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos
233 diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos
234 export: output, switch-parent, rev, text, git, binary, nodates, template
234 export: bookmark, output, switch-parent, rev, text, git, binary, nodates, template
235 forget: interactive, include, exclude, dry-run
235 forget: interactive, include, exclude, dry-run
236 init: ssh, remotecmd, insecure
236 init: ssh, remotecmd, insecure
237 log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
237 log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
@@ -101,6 +101,44 b' Doing it again clobbers the files rather'
101 $ grep HG foo-foo_3.patch | wc -l
101 $ grep HG foo-foo_3.patch | wc -l
102 \s*1 (re)
102 \s*1 (re)
103
103
104 Using bookmarks:
105
106 $ hg book -f -r 9 @
107 $ hg book -f -r 11 test
108 $ hg export -B test
109 # HG changeset patch
110 # User test
111 # Date 0 0
112 # Thu Jan 01 00:00:00 1970 +0000
113 # Node ID 5f17a83f5fbd9414006a5e563eab4c8a00729efd
114 # Parent 747d3c68f8ec44bb35816bfcd59aeb50b9654c2f
115 foo-10
116
117 diff -r 747d3c68f8ec -r 5f17a83f5fbd foo
118 --- a/foo Thu Jan 01 00:00:00 1970 +0000
119 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
120 @@ -8,3 +8,4 @@
121 foo-7
122 foo-8
123 foo-9
124 +foo-10
125 # HG changeset patch
126 # User test
127 # Date 0 0
128 # Thu Jan 01 00:00:00 1970 +0000
129 # Node ID f3acbafac161ec68f1598af38f794f28847ca5d3
130 # Parent 5f17a83f5fbd9414006a5e563eab4c8a00729efd
131 foo-11
132
133 diff -r 5f17a83f5fbd -r f3acbafac161 foo
134 --- a/foo Thu Jan 01 00:00:00 1970 +0000
135 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
136 @@ -9,3 +9,4 @@
137 foo-8
138 foo-9
139 foo-10
140 +foo-11
141
104 Exporting 4 changesets to a file:
142 Exporting 4 changesets to a file:
105
143
106 $ hg export -o export_internal 1 2 3 4
144 $ hg export -o export_internal 1 2 3 4
General Comments 0
You need to be logged in to leave comments. Login now