~jan0sch/smederee

Showing details for patch cfdff6345b3aae5b3ee297b3e5fa33ec99f63e36.
2022-08-07 (Sun), 1:58 PM - Jens Grassel - cfdff6345b3aae5b3ee297b3e5fa33ec99f63e36

darcs: add show dependencies command

Summary of changes
1 files modified with 24 lines added and 1 lines removed
  • modules/darcs/src/main/scala/de/smederee/darcs/DarcsCommands.scala with 24 added and 1 removed lines
diff -rN -u old-smederee/modules/darcs/src/main/scala/de/smederee/darcs/DarcsCommands.scala new-smederee/modules/darcs/src/main/scala/de/smederee/darcs/DarcsCommands.scala
--- old-smederee/modules/darcs/src/main/scala/de/smederee/darcs/DarcsCommands.scala	2025-02-02 19:58:25.825854357 +0000
+++ new-smederee/modules/darcs/src/main/scala/de/smederee/darcs/DarcsCommands.scala	2025-02-02 19:58:25.825854357 +0000
@@ -83,6 +83,29 @@
     } yield DarcsCommandOutput(process.exitCode, Chain(process.out.text()), Chain(process.err.text()))
   }
 
+  /** Run the darcs show dependencies command on the given repository and return the output.
+    *
+    * @param basePath
+    *   The base path under which the repository is located.
+    * @param repositoryName
+    *   The name of the repository.
+    * @param options
+    *   Additional options for the show command.
+    * @return
+    *   The output of the darcs command.
+    */
+  def showDependencies(
+      basePath: Path
+  )(repositoryName: String)(options: Chain[String]): F[DarcsCommandOutput] = {
+    log.trace(s"Execute $darcsBinary show dependencies in $basePath/$repositoryName with $options")
+    val directory       = Paths.get(basePath.toString, repositoryName)
+    val darcsOptions    = List("show", "dependencies") ::: options.toList
+    val externalCommand = os.proc(darcsBinary.toString, darcsOptions)
+    for {
+      process <- Sync[F].delay(externalCommand.call(cwd = os.Path(directory), check = false))
+    } yield DarcsCommandOutput(process.exitCode, Chain(process.out.text()), Chain(process.err.text()))
+  }
+
   /** Run the darcs whatsnew command on the given repository and return the output.
     *
     * @param basePath
@@ -90,7 +113,7 @@
     * @param repositoryName
     *   The name of the repository.
     * @param options
-    *   Additional options for the log command.
+    *   Additional options for the whatsnew command.
     * @return
     *   The output of the darcs command.
     */