Skip to content

Commit ee98694

Browse files
committed
Move findoutmore and examples to the end to preserve similar flow between html and pdf
1 parent d0abdf2 commit ee98694

File tree

1 file changed

+69
-69
lines changed

1 file changed

+69
-69
lines changed

docs/basics/101-132-advancednesting.rst

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,67 @@ should be up to you to decide whether you want record something or not --,
5050
but it is worth repeating: If you modify a subdataset, you will need to save
5151
this *in the superdataset* in order to have a clean superdataset status.
5252

53+
Let's save the modification of the subdataset into the history of the
54+
superdataset. For this, to avoid confusion, you can specify explicitly to
55+
which dataset you want to save a modification. ``-d .`` specifies the current
56+
dataset, i.e., ``DataLad-101``, as the dataset to save to:
57+
58+
.. runrecord:: _examples/DL-101-132-103
59+
:language: console
60+
:workdir: dl-101/DataLad-101/
61+
62+
$ datalad save -d . -m "finished my midterm project" midterm_project
63+
64+
.. index::
65+
pair: save modification in nested dataset; with DataLad
66+
.. find-out-more:: More on how 'datalad save' can operate on nested datasets
67+
68+
In a superdataset with subdatasets, :dlcmd:`save` by default
69+
tries to figure out on its own which dataset's history of all available
70+
datasets a :dlcmd:`save` should be written to. However, it can reduce
71+
confusion or allow specific operations to be very explicit in the command
72+
call and tell DataLad where to save what kind of modifications to.
73+
74+
If you want to save the current state of the subdataset into the superdataset
75+
(as necessary here), start a ``save`` from the superdataset and have the
76+
``-d/--dataset`` option point to its root:
77+
78+
.. code-block:: bash
79+
80+
# in the root of the superds
81+
$ datalad save -d . -m "update subdataset"
82+
83+
If you are in the superdataset, and you want to save an unsaved modification
84+
in a subdataset to the *subdatasets* history, let ``-d/--dataset`` point to
85+
the subdataset:
86+
87+
.. code-block:: bash
88+
89+
# in the superds
90+
$ datalad save -d path/to/subds -m "modified XY"
91+
92+
The recursive option allows you to save any content underneath the specified
93+
directory, and recurse into any potential subdatasets:
94+
95+
.. code-block:: bash
96+
97+
$ datalad save . --recursive
98+
99+
Let's check which subproject commit is now recorded in the superdataset:
100+
101+
.. runrecord:: _examples/DL-101-132-104
102+
:language: console
103+
:workdir: dl-101/DataLad-101/
104+
:emphasize-lines: 14
105+
106+
$ git log -p -n 1
107+
108+
As you can see in the log entry, the subproject commit changed from the
109+
first commit hash in the subdataset history to the most recent one. With this
110+
change, therefore, your superdataset tracks the most recent version of
111+
the ``midterm_project`` dataset, and your dataset's status is clean again.
112+
113+
53114
This point in time in DataLad-101 is a convenient moment to dive a bit deeper
54115
into the functions of the :dlcmd:`status` command. If you are
55116
interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
@@ -92,7 +153,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
92153
subdataset contains a modification. For this, let's add an empty text file into
93154
the ``midterm_project`` subdataset:
94155

95-
.. runrecord:: _examples/DL-101-132-103
156+
.. runrecord:: _examples/DL-101-132-105
96157
:language: console
97158
:workdir: dl-101/DataLad-101
98159

@@ -102,7 +163,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
102163
*within* the subdataset, simply provide a path (relative to your current location)
103164
to the command:
104165

105-
.. runrecord:: _examples/DL-101-132-104
166+
.. runrecord:: _examples/DL-101-132-106
106167
:language: console
107168
:workdir: dl-101/DataLad-101
108169

@@ -112,7 +173,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
112173
and provide a path to the subdataset *with a trailing path separator* like
113174
this:
114175

115-
.. runrecord:: _examples/DL-101-132-105
176+
.. runrecord:: _examples/DL-101-132-107
116177
:language: console
117178
:workdir: dl-101/DataLad-101
118179

@@ -127,7 +188,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
127188
path to the dataset (without a trailing path separator). This can be used
128189
to specify a specific subdataset in the case of a dataset with many subdatasets:
129190

130-
.. runrecord:: _examples/DL-101-132-106
191+
.. runrecord:: _examples/DL-101-132-108
131192
:language: console
132193
:workdir: dl-101/DataLad-101
133194

@@ -138,7 +199,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
138199
the state of the subdataset within the superdataset, you can combine the
139200
two paths:
140201

141-
.. runrecord:: _examples/DL-101-132-107
202+
.. runrecord:: _examples/DL-101-132-109
142203
:language: console
143204
:workdir: dl-101/DataLad-101
144205

@@ -147,7 +208,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
147208
Finally, if these subtle differences in the paths are not easy to memorize,
148209
the ``-r/--recursive`` option will also report you both status aspects:
149210

150-
.. runrecord:: _examples/DL-101-132-108
211+
.. runrecord:: _examples/DL-101-132-110
151212
:language: console
152213
:workdir: dl-101/DataLad-101
153214

@@ -156,7 +217,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
156217
Importantly, the regular output from a :dlcmd:`status` command in the commandline is "condensed" to the most important information by a tailored result renderer.
157218
You can, however, also get ``status``' unfiltered full output by switching the ``-f``/``--output-format`` from ``tailored`` (the default) to ``json`` or, for the same infos as ``json`` but better readability, ``json_pp``:
158219

159-
.. runrecord:: _examples/DL-101-132-108a
220+
.. runrecord:: _examples/DL-101-132-111
160221
:language: console
161222
:workdir: dl-101/DataLad-101
162223

@@ -172,74 +233,13 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
172233
Before we leave this Find-out-more, lets undo the modification of the subdataset
173234
by removing the untracked file:
174235

175-
.. runrecord:: _examples/DL-101-132-109
236+
.. runrecord:: _examples/DL-101-132-112
176237
:language: console
177238
:workdir: dl-101/DataLad-101
178239

179240
$ rm midterm_project/an_empty_file
180241
$ datalad status --recursive
181242

182-
Let's save the modification of the subdataset into the history of the
183-
superdataset. For this, to avoid confusion, you can specify explicitly to
184-
which dataset you want to save a modification. ``-d .`` specifies the current
185-
dataset, i.e., ``DataLad-101``, as the dataset to save to:
186-
187-
.. runrecord:: _examples/DL-101-132-110
188-
:language: console
189-
:workdir: dl-101/DataLad-101/
190-
191-
$ datalad save -d . -m "finished my midterm project" midterm_project
192-
193-
.. index::
194-
pair: save modification in nested dataset; with DataLad
195-
.. find-out-more:: More on how 'datalad save' can operate on nested datasets
196-
197-
In a superdataset with subdatasets, :dlcmd:`save` by default
198-
tries to figure out on its own which dataset's history of all available
199-
datasets a :dlcmd:`save` should be written to. However, it can reduce
200-
confusion or allow specific operations to be very explicit in the command
201-
call and tell DataLad where to save what kind of modifications to.
202-
203-
If you want to save the current state of the subdataset into the superdataset
204-
(as necessary here), start a ``save`` from the superdataset and have the
205-
``-d/--dataset`` option point to its root:
206-
207-
.. code-block:: bash
208-
209-
# in the root of the superds
210-
$ datalad save -d . -m "update subdataset"
211-
212-
If you are in the superdataset, and you want to save an unsaved modification
213-
in a subdataset to the *subdatasets* history, let ``-d/--dataset`` point to
214-
the subdataset:
215-
216-
.. code-block:: bash
217-
218-
# in the superds
219-
$ datalad save -d path/to/subds -m "modified XY"
220-
221-
The recursive option allows you to save any content underneath the specified
222-
directory, and recurse into any potential subdatasets:
223-
224-
.. code-block:: bash
225-
226-
$ datalad save . --recursive
227-
228-
Let's check which subproject commit is now recorded in the superdataset:
229-
230-
.. runrecord:: _examples/DL-101-132-112
231-
:language: console
232-
:workdir: dl-101/DataLad-101/
233-
:emphasize-lines: 14
234-
235-
$ git log -p -n 1
236-
237-
As you can see in the log entry, the subproject commit changed from the
238-
first commit hash in the subdataset history to the most recent one. With this
239-
change, therefore, your superdataset tracks the most recent version of
240-
the ``midterm_project`` dataset, and your dataset's status is clean again.
241-
242-
243243
.. only:: adminmode
244244

245245
Add a tag at the section end.

0 commit comments

Comments
 (0)