sapling/addons/shared/constants.ts
Evan Krause 3e46e283a4 Warn on goto to a very old commit
Summary:
If you click `goto` on a commit that's much older than your current comit, then `sl` will need to update your checkout to match which can be slow. It's usually faster to rebase the destination to a more recent base, then goto.

Show a warning when about to do a goto.

Notes:
- don't show the warning if you're going to a newer dest. You'll want to eventually move forward, so there's no use warning.
- compute the age difference between the public ancestors of source and dest. If you have draft commits based on two public commits that are very far apart, it doesn't matter when you made the draft commits, only how many public commits are in between.
- This is especially useful with edenfs.
- This matters mostly for extremely large repos. Technically, age is just a proxy for it being a large distance apart. Internally, we know we need an aggressive age cutoff measured in days. In OSS, it probably matters less. Let's be less restrictive there and use 1 month.
- age cutoff is set by the code review provider, so even Internal GitHub repos can have a more lenient cutoff before warning.

Reviewed By: quark-zju

Differential Revision: D56260464

fbshipit-source-id: ab50dc55c73ac4948b7b9bc5495826040561fda1
2024-04-18 15:38:19 -07:00

10 lines
270 B
TypeScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** One day in milliseconds */
export const MS_PER_DAY = 1000 * 60 * 60 * 24;