Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13995627
D10226.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D10226.id.diff
View Options
diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php
--- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php
+++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php
@@ -135,12 +135,6 @@
$futures = array();
foreach ($this->refs as $ref) {
- // TODO: There was a note about `--rev 'a b'` not working for branches
- // with spaces in their names in older code, but I suspect this was
- // misidentified and resulted from the branch name being interpeted as
- // a revset. Use hgsprintf() to avoid that. If this doesn't break for a
- // bit, remove this comment. Otherwise, consider `-b %s --limit 1`.
-
$futures[$ref] = $repository->getLocalCommandFuture(
'log --template=%s --rev %s',
'{node}',
diff --git a/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php b/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
--- a/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
+++ b/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
@@ -63,6 +63,7 @@
}
}
$all_closing_heads = array_unique($all_closing_heads);
+ $all_closing_heads = $this->removeMissingCommits($all_closing_heads);
foreach ($maps as $type => $refs) {
$cursor_group = idx($cursor_groups, $type, array());
@@ -105,6 +106,35 @@
return $this;
}
+ /**
+ * Remove commits which no longer exist in the repository from a list.
+ *
+ * After a force push and garbage collection, we may have branch cursors which
+ * point at commits which no longer exist. This can make commands issued later
+ * fail. See T5839 for discussion.
+ *
+ * @param list<string> List of commit identifiers.
+ * @return list<string> List with nonexistent identifiers removed.
+ */
+ private function removeMissingCommits(array $identifiers) {
+ if (!$identifiers) {
+ return array();
+ }
+
+ $resolved = id(new DiffusionLowLevelResolveRefsQuery())
+ ->setRepository($this->getRepository())
+ ->withRefs($identifiers)
+ ->execute();
+
+ foreach ($identifiers as $key => $identifier) {
+ if (empty($resolved[$identifier])) {
+ unset($identifiers[$key]);
+ }
+ }
+
+ return $identifiers;
+ }
+
private function updateCursors(
array $cursors,
array $new_refs,
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php
--- a/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php
@@ -42,6 +42,7 @@
public function execute(PhutilArgumentParser $args) {
$this->setVerbose($args->getArg('verbose'));
+ $console = PhutilConsole::getConsole();
$repos = $this->loadRepositories($args, 'repos');
if (count($repos) !== 1) {
@@ -103,6 +104,11 @@
$lock->unlock();
+ $console->writeOut(
+ pht(
+ 'Updated repository **%s**.',
+ $repository->getMonogram())."\n");
+
return 0;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 24, 2:20 PM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6730273
Default Alt Text
D10226.id.diff (3 KB)
Attached To
Mode
D10226: Allow repo updates to recover after force push + garbage collection
Attached
Detach File
Event Timeline
Log In to Comment