Mercurial Subrepos, how to control which changes I want to use for submeaning?

I read on subrepos and run some tests locally, it seems to be working fine so far, but I have one question.

How to specify / control which changes I want to use for a specific subreport?

For example, let's say I have the following two projects:

class library                    application
o    fourth commit               o   second commit, added a feature
|                                |
o    third commit                o   initial commit
| 
| o  second commit
|/
o    initial commit

Now I want the class library to be a sub-reporter of my application, but because of the immaturity of the longest branch (the one that ends as the fourth commit), I want to temporarily use the "second commit" hint.

How do I customize the setup, assuming this is possible?

Here the batch file that installs the two + abovereactors adds the library as a subreport.

If you run the batch file, it will output:

[C:\Temp] :test
...
v4

, , "v4" . , "v2" "v2", .

- , , , , , ?

Batch :

@echo off
if exist app rd /s /q app
if exist lib rd /s /q lib
if exist app-clone rd /s /q app-clone


rem == app ==
hg init app
cd app
echo program>main.txt
hg add main.txt
hg commit -m "initial commit"
echo program+feature1>main.txt
hg commit -m "second commit, added a feature"
cd ..

rem == lib ==
hg init lib
cd lib
echo v1>lib.txt
hg add lib.txt
hg commit -m "initial commit"
echo v2>lib.txt
hg commit -m "second commit"
hg update 0
echo v3>lib.txt
hg commit -m "third commit"
echo v4>lib.txt
hg commit -m "fourth commit"
cd ..

rem == subrepos ==
cd app
hg clone ..\lib lib
echo lib = ..\lib >.hgsub
hg add .hgsub
hg commit -m "added subrepo"
cd ..

rem == clone ==
hg clone app app-clone

type app-clone\lib\lib.txt

: , , @VonC, , rem == clone == , subrepo .

rem == lock ==
cd app\lib
hg update 1
cd ..
hg commit -m "lock to second commit"
cd ..
+2
2

, , (hg update), ( ) .
.hgsubstate .

( , .hgsubstate, .)

hg subrepos ( Git subodules) , -. , (v4 ), .

, , :

, commit , .

:

  • .
  • .hgsubstate (id) .
+2

, , , , , . , "-r" :

rem == subrepos ==
cd app
hg clone -r CHANGESETYOUWANT ..\lib lib
echo lib = ..\lib >.hgsub
hg add .hgsub
hg commit -m "added subrepo"
cd ..

3.

+2

Source: https://habr.com/ru/post/1746459/


All Articles