2016-01-08 1 views
0

Как известно, явные зависимости патчей могут быть записаны darcs record --ask-deps. (Использование, которое я вижу для этого, предотвращает ситуации, когда «It's easy to move a patch that uses a feature to a point before the feature is introduced.».)Как проверить явные зависимости патча в darcs?

Итак, имея репо, где я должен был делать такие отпечатки, я хочу проверить, правда ли это. Как проверить записанные явные зависимости выбранного патча?

Google может найти мне код в Darcs/UI/Commands/Rebase.hs, который печатает предупреждение, если у патча были такие отпечатки, но я еще не знаю, есть ли автономная команда, которая просто предоставила бы эту информацию (не связанная с действием):

where doAdd :: (RepoPatch p, ApplyState p ~ Tree) 
      => Repository (Rebasing p) wR wU wT 
      -> FL (WDDNamed p) wT wT2 
      -> HijackT IO (Repository (Rebasing p) wR wU wT2, FL (RebaseName p) wT2 wT2) 
     doAdd repo NilFL = return (repo, NilFL) 
     doAdd repo ((p :: WDDNamed p wT wU) :>:ps) = do 
      case wddDependedOn p of 
       [] -> return() 
       deps -> liftIO $ do 
        -- It might make sense to only print out this message once, but we might find 
        -- that the dropped dependencies are interspersed with other output, 
        -- e.g. if running with --ask-deps 
        putStr $ "Warning: dropping the following explicit " 
          ++ englishNum (length deps) (Noun "dependency") ":\n\n" 
        let printIndented n = 
          mapM_ (putStrLn . (replicate n ' '++)) . lines . 
          renderString Encode . showPatchInfo 
        putStrLn . renderString Encode . showPatchInfo . 
          patch2patchinfo $ wddPatch p 
        putStr " depended on:\n" 
        mapM_ (printIndented 2) deps 
        putStr "\n" 
... 

Может быть, это команда, которая выводит .dpatch будет включать эту информацию в dpatch. Я должен проверить это сейчас.

Ни darcs log -v (http://bugs.darcs.net/issue959) ни darcs diff выводит эту информацию в соответствии с моими экспериментами.

+1

Обратите внимание, что в darcs 2.12 по май 2016 года есть 'darcs show dependencies' – IARI

ответ

0

Один из способов - вывести .dpatch с помощью darcs send и изучить его.

Это не очень удобный способ, потому что

  1. darcs send нуждается в целевой репозиторий (даже с -o FILE.dpatch);
  2. несколько патчей попадают в пучок, вместо одной, которую мы хотим, чтобы проверить ...

Вот пример (я также проверил, что darcs log -v не дает информации о явных зависимости):

Приготовление:

$ mkdir test-darcs-deps 
$ cd test-darcs-deps/ 
$ darcs init 
$ echo a > a 
$ darcs add a 
$ darcs rec -m A 
$ echo b > b 
$ darcs add b 
$ darcs rec -m B 

Запись явную зависимость:

$ echo b2 > b 
$ darcs rec --ask-deps 
hunk ./b 1 
-b 
+b2 
Shall I record this change? (1/1) [ynW...], or ? for more options: y 
Do you want to record these changes? [Yglqk...], or ? for more options: y 
patch 1f59d082f61f1fb8d57f5f5199869d1fc21b2435 
Author: Ivan Zakharyaschev <[email protected]> 
Date: Sat Jan 9 01:28:07 MSK 2016 
    * A 
Shall I depend on this patch? (1/1) [ynW...], or ? for more options: y 
Do you want to depend on these patches? [Yglqk...], or ? for more options: y 
Finished recording patch 'B2' 

Инспектирование DEPS (я должен был обратиться к репо не связанных Darcs в для того, чтобы darcs send работать!):

$ darcs send -o ../test-darcs-deps.dpatch 
Missing argument: [REPOSITORY] 
Usage: darcs send [OPTION]... [REPOSITORY] 
Prepare a bundle of patches to be applied to some target repository. 

See darcs help send for details. 

$ darcs send -o ../test-darcs-deps.dpatch ../test-darcs 
HINT: if you want to change the default remote repository to 
     /home/imz/tests/test-darcs, 
     quit now and issue the same command with the --set-default flag. 
patch 1f59d082f61f1fb8d57f5f5199869d1fc21b2435 
Author: Ivan Zakharyaschev <[email protected]> 
Date: Sat Jan 9 01:28:07 MSK 2016 
    * A 

    A ./a 
Shall I send this patch? (1/3) [ynW...], or ? for more options: w 
patch 151c8321b2bc36df7ba09dcab0d17c853ed31577 
Author: Ivan Zakharyaschev <[email protected]> 
Date: Sat Jan 9 01:28:32 MSK 2016 
    * B 

    A ./b 
Shall I send this patch? (2/3) [ynW...], or ? for more options: w 
patch f697ac56e8241f5a906c010650b683638944ebf2 
Author: Ivan Zakharyaschev <[email protected]> 
Date: Sat Jan 9 01:28:50 MSK 2016 
    * B2 

    M ./b -1 +1 
Shall I send this patch? (3/3) [ynW...], or ? for more options: y 
Do you want to send these patches? [Yglqk...], or ? for more options: l 
---- Already selected patches ---- 
patch 151c8321b2bc36df7ba09dcab0d17c853ed31577 
Author: Ivan Zakharyaschev <[email protected]> 
Date: Sat Jan 9 01:28:32 MSK 2016 
    * B 

    A ./b 
patch 1f59d082f61f1fb8d57f5f5199869d1fc21b2435 
Author: Ivan Zakharyaschev <[email protected]> 
Date: Sat Jan 9 01:28:07 MSK 2016 
    * A 

    A ./a 
patch f697ac56e8241f5a906c010650b683638944ebf2 
Author: Ivan Zakharyaschev <[email protected]> 
Date: Sat Jan 9 01:28:50 MSK 2016 
    * B2 

    M ./b -1 +1 
---- end of already selected patches ---- 
Do you want to send these patches? [Yglqk...], or ? for more options: y 
Minimizing context, to send with full context hit ctrl-C... 
File content did not change. Continue anyway? [yn]y 

Зависимость можно увидеть в угловых скобках в выводе:

[B2 
Ivan Zakharyaschev <[email protected]>**20160108222850 
Ignore-this: e8693b796cd3cac50bb19f4458ddb323 
] 
< 
[A 
Ivan Zakharyaschev <[email protected]>**20160108222807 
Ignore-this: 613cadd9266dac24e2bcd2dde97d969a 
] 
> hunk ./b 1 
-b 
+b2 

Вот полный выход:

3 patches for repository /home/imz/tests/test-darcs: 

patch 151c8321b2bc36df7ba09dcab0d17c853ed31577 
Author: Ivan Zakharyaschev <[email protected]> 
Date: Sat Jan 9 01:28:32 MSK 2016 
    * B 

patch 1f59d082f61f1fb8d57f5f5199869d1fc21b2435 
Author: Ivan Zakharyaschev <[email protected]> 
Date: Sat Jan 9 01:28:07 MSK 2016 
    * A 

patch f697ac56e8241f5a906c010650b683638944ebf2 
Author: Ivan Zakharyaschev <[email protected]> 
Date: Sat Jan 9 01:28:50 MSK 2016 
    * B2 

New patches: 

[B 
Ivan Zakharyaschev <[email protected]>**20160108222832 
Ignore-this: 9558077a30e30ba3c99003a4418991d 
] addfile ./b 
hunk ./b 1 
+b 

[A 
Ivan Zakharyaschev <[email protected]>**20160108222807 
Ignore-this: 613cadd9266dac24e2bcd2dde97d969a 
] addfile ./a 
hunk ./a 1 
+a 

[B2 
Ivan Zakharyaschev <[email protected]>**20160108222850 
Ignore-this: e8693b796cd3cac50bb19f4458ddb323 
] 
< 
[A 
Ivan Zakharyaschev <[email protected]>**20160108222807 
Ignore-this: 613cadd9266dac24e2bcd2dde97d969a 
] 
> hunk ./b 1 
-b 
+b2 

Context: 

Patch bundle hash: 
f7ff61d69da702263b2ac613d3ca979ecab5b07b 

Не совсем удобно.

 Смежные вопросы

  • Нет связанных вопросов^_^